Package net.i2p.socks
Class SOCKS5Client
java.lang.Object
net.i2p.socks.SOCKS5Client
A simple SOCKS 5 client.
Note: Caller is advised to setSoTimeout on the socket. Not done here.
- Since:
- 0.9.33 adapted from net.i2p.i2ptunnel.socks.SOCKS5Server
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
connect
(InputStream pin, OutputStream pout, String connHostName, int connPort) Act as a SOCKS 5 client to connect to a proxy Will throw and close pin and pout on all errors.static void
connect
(InputStream pin, OutputStream pout, String connHostName, int connPort, String configUser, String configPW) Act as a SOCKS 5 client to connect to a proxy Will throw and close pin and pout on all errors.static void
Act as a SOCKS 5 client to connect to a proxy Will throw and close sock on all errors.static void
Act as a SOCKS 5 client to connect to a proxy Will throw and close sock on all errors.
-
Method Details
-
connect
Act as a SOCKS 5 client to connect to a proxy Will throw and close sock on all errors. Caller must close sock on success.- Parameters:
sock
- socket to the proxyconnHostName
- hostname or IP for the proxy to connect toconnPort
- port for the proxy to connect to- Throws:
IOException
-
connect
public static void connect(Socket sock, String connHostName, int connPort, String configUser, String configPW) throws IOException Act as a SOCKS 5 client to connect to a proxy Will throw and close sock on all errors. Caller must close sock on success.- Parameters:
sock
- socket to the proxyconnHostName
- hostname or IP for the proxy to connect toconnPort
- port for the proxy to connect toconfigUser
- username for proxy authentication or nullconfigPW
- password for proxy authentication or null- Throws:
IOException
-
connect
public static void connect(InputStream pin, OutputStream pout, String connHostName, int connPort) throws IOException Act as a SOCKS 5 client to connect to a proxy Will throw and close pin and pout on all errors. Caller must close pin and pout on success.- Parameters:
pin
- input stream from the proxypout
- output stream to the proxyconnHostName
- hostname or IP for the proxy to connect toconnPort
- port for the proxy to connect to- Throws:
IOException
-
connect
public static void connect(InputStream pin, OutputStream pout, String connHostName, int connPort, String configUser, String configPW) throws IOException Act as a SOCKS 5 client to connect to a proxy Will throw and close pin and pout on all errors. Caller must close pin and pout on success.- Parameters:
pin
- input stream from the proxypout
- output stream to the proxyconnHostName
- hostname or IP for the proxy to connect toconnPort
- port for the proxy to connect toconfigUser
- username for proxy authentication or nullconfigPW
- password for proxy authentication or null- Throws:
IOException
-