HTTPClient
Class SocksClient
java.lang.Object
|
+--HTTPClient.SocksClient
- class SocksClient
- extends java.lang.Object
This class implements a SOCKS Client. Supports both versions 4 and 5.
GSSAPI however is not yet implemented.
Usage is as follows: somewhere in the initialization code (and before
the first socket creation call) create a SocksClient instance. Then replace
each socket creation call
sock = new Socket(host, port);
with
sock = socks_client.getSocket(host, port);
(where socks_client is the above created SocksClient instance).
That's all.
(package private) |
SocksClient(java.lang.String host,
int port)
Creates a new SOCKS Client using the specified host and port for
the server. |
(package private) |
SocksClient(java.lang.String host,
int port,
int version)
Creates a new SOCKS Client using the specified host and port for
the server. |
| Type | Method |
(package private) java.net.Socket |
getSocket(java.lang.String host,
int port)
Initiates a connection to the socks server, does the startup
protocol and returns a socket ready for talking. |
(package private) java.net.Socket |
getSocket(java.lang.String host,
int port,
java.net.InetAddress localAddr,
int localPort)
Initiates a connection to the socks server, does the startup
protocol and returns a socket ready for talking. |
java.lang.String |
toString()
produces a string. |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SocksClient
SocksClient(java.lang.String host,
int port)
- Creates a new SOCKS Client using the specified host and port for
the server. Will try to establish the SOCKS version used when
establishing the first connection.
- Parameters:
host - the host the SOCKS server is sitting on.port - the port the SOCKS server is listening on.
SocksClient
SocksClient(java.lang.String host,
int port,
int version)
throws SocksException
- Creates a new SOCKS Client using the specified host and port for
the server.
- Parameters:
host - the host the SOCKS server is sitting on.port - the port the SOCKS server is listening on.version - the version the SOCKS server is using.- Throws:
SocksException
- if the version is invalid (Currently allowed
are: 4 and 5).
getSocket
java.net.Socket getSocket(java.lang.String host,
int port)
throws java.io.IOException
- Initiates a connection to the socks server, does the startup
protocol and returns a socket ready for talking.
- Parameters:
host - the host you wish to connect toport - the port you wish to connect to- Returns:
- a Socket with a connection via socks to the desired host/port
- Throws:
java.io.IOException
- if any socket operation fails
getSocket
java.net.Socket getSocket(java.lang.String host,
int port,
java.net.InetAddress localAddr,
int localPort)
throws java.io.IOException
- Initiates a connection to the socks server, does the startup
protocol and returns a socket ready for talking.
- Parameters:
host - the host you wish to connect toport - the port you wish to connect tolocalAddr - the local address to bind tolocalPort - the local port to bind to- Returns:
- a
Socket with a connection via socks to the desired host/port
- Throws:
java.io.IOException - if any socket operation fails
toString
public java.lang.String toString()
- produces a string.
- Overrides:
toString in class java.lang.Object
- Returns:
- a string containing the host and port of the socks server