socks
Class Socks5Proxy

java.lang.Object
  |
  +--socks.Proxy
        |
        +--socks.Socks5Proxy

public class Socks5Proxy
extends Proxy
implements java.lang.Cloneable

SOCKS5 Proxy.


Fields inherited from class socks.Proxy
SOCKS_ADDR_NOT_SUPPORTED, SOCKS_AUTH_FAILURE, SOCKS_AUTH_NOT_SUPPORTED, SOCKS_BADCONNECT, SOCKS_BADNETWORK, SOCKS_CMD_NOT_SUPPORTED, SOCKS_CONNECTION_REFUSED, SOCKS_DIRECT_FAILED, SOCKS_FAILURE, SOCKS_HOST_UNREACHABLE, SOCKS_JUST_ERROR, SOCKS_METHOD_NOTSUPPORTED, SOCKS_NO_PROXY, SOCKS_PROXY_IO_ERROR, SOCKS_PROXY_NO_CONNECT, SOCKS_SUCCESS, SOCKS_TTL_EXPIRE
 
Constructor Summary
Socks5Proxy(java.net.InetAddress proxyIP, int proxyPort)
          Creates SOCKS5 proxy.
Socks5Proxy(Proxy p, java.net.InetAddress proxyIP, int proxyPort)
          Creates SOCKS5 proxy.
Socks5Proxy(Proxy p, java.lang.String proxyHost, int proxyPort)
          Creates SOCKS5 proxy.
Socks5Proxy(java.lang.String proxyHost, int proxyPort)
          Creates SOCKS5 proxy.
 
Method Summary
 java.lang.Object clone()
          Creates a clone of this Proxy.
 Authentication getAuthenticationMethod(int methodId)
          Get authentication method, which corresponds to given method id
 boolean resolveAddrLocally()
          Get current setting on how the addresses should be handled.
 boolean resolveAddrLocally(boolean doResolve)
          Wether to resolve address locally or to let proxy do so.
 boolean setAuthenticationMethod(int methodId, Authentication method)
          Adds another authentication method.
 
Methods inherited from class socks.Proxy
addDirect, addDirect, addDirect, getChainProxy, getDefaultProxy, getDirect, getInetAddress, getPort, isDirect, isDirect, parseProxy, setChainProxy, setDefaultProxy, setDefaultProxy, setDefaultProxy, setDefaultProxy, setDefaultProxy, setDirect, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Socks5Proxy

public Socks5Proxy(Proxy p,
                   java.lang.String proxyHost,
                   int proxyPort)
            throws java.net.UnknownHostException
Creates SOCKS5 proxy.
Parameters:
p - Proxy to use to connect to this proxy, allows proxy chaining.
proxyHost - Host on which a Proxy server runs.
proxyPort - Port on which a Proxy server listens for connections.
Throws:
java.net.UnknownHostException - If proxyHost can't be resolved.

Socks5Proxy

public Socks5Proxy(java.lang.String proxyHost,
                   int proxyPort)
            throws java.net.UnknownHostException
Creates SOCKS5 proxy.
Parameters:
proxyHost - Host on which a Proxy server runs.
proxyPort - Port on which a Proxy server listens for connections.
Throws:
java.net.UnknownHostException - If proxyHost can't be resolved.

Socks5Proxy

public Socks5Proxy(Proxy p,
                   java.net.InetAddress proxyIP,
                   int proxyPort)
Creates SOCKS5 proxy.
Parameters:
p - Proxy to use to connect to this proxy, allows proxy chaining.
proxyIP - Host on which a Proxy server runs.
proxyPort - Port on which a Proxy server listens for connections.

Socks5Proxy

public Socks5Proxy(java.net.InetAddress proxyIP,
                   int proxyPort)
Creates SOCKS5 proxy.
Parameters:
proxyIP - Host on which a Proxy server runs.
proxyPort - Port on which a Proxy server listens for connections.
Method Detail

resolveAddrLocally

public boolean resolveAddrLocally(boolean doResolve)
Wether to resolve address locally or to let proxy do so.

SOCKS5 protocol allows to send host names rather then IPs in the requests, this option controls wether the hostnames should be send to the proxy server as names, or should they be resolved locally.

Parameters:
doResolve - Wether to perform resolution locally.
Returns:
Previous settings.

resolveAddrLocally

public boolean resolveAddrLocally()
Get current setting on how the addresses should be handled.
Returns:
Current setting for address resolution.
See Also:
resolveAddrLocally(boolean doResolve)

setAuthenticationMethod

public boolean setAuthenticationMethod(int methodId,
                                       Authentication method)
Adds another authentication method.
Parameters:
methodId - Authentication method id, see rfc1928
method - Implementation of Authentication
See Also:
Authentication

getAuthenticationMethod

public Authentication getAuthenticationMethod(int methodId)
Get authentication method, which corresponds to given method id
Parameters:
methodId - Authentication method id.
Returns:
Implementation for given method or null, if one was not set.

clone

public java.lang.Object clone()
Creates a clone of this Proxy.