Class Socks5Client
- java.lang.Object
-
- org.jivesoftware.smackx.bytestreams.socks5.Socks5Client
-
- Direct Known Subclasses:
Socks5ClientForInitiator
public class Socks5Client extends Object
The SOCKS5 client class handles establishing a connection to a SOCKS5 proxy. Connecting to a SOCKS5 proxy requires authentication. This implementation only supports the no-authentication authentication method.
-
-
Field Summary
Fields Modifier and Type Field Description protected String
digest
protected Bytestream.StreamHost
streamHost
-
Constructor Summary
Constructors Constructor Description Socks5Client(Bytestream.StreamHost streamHost, String digest)
Constructor for a SOCKS5 client.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
establish(Socket socket)
Initializes the connection to the SOCKS5 proxy by negotiating authentication method and requesting a stream for the given digest.Socket
getSocket(int timeout)
Returns the initialized socket that can be used to transfer data between peers via the SOCKS5 proxy.
-
-
-
Field Detail
-
streamHost
protected Bytestream.StreamHost streamHost
-
-
Constructor Detail
-
Socks5Client
public Socks5Client(Bytestream.StreamHost streamHost, String digest)
Constructor for a SOCKS5 client.- Parameters:
streamHost
- containing network settings of the SOCKS5 proxydigest
- identifying the SOCKS5 Bytestream
-
-
Method Detail
-
getSocket
public Socket getSocket(int timeout) throws IOException, InterruptedException, TimeoutException, XMPPException, SmackException.SmackMessageException, SmackException.NotConnectedException, SmackException.NoResponseException
Returns the initialized socket that can be used to transfer data between peers via the SOCKS5 proxy.- Parameters:
timeout
- timeout to connect to SOCKS5 proxy in milliseconds- Returns:
- socket the initialized socket
- Throws:
IOException
- if initializing the socket failed due to a network errorTimeoutException
- if connecting to SOCKS5 proxy timed outInterruptedException
- if the current thread was interrupted while waitingXMPPException
- if an XMPP protocol error was received.SmackException.SmackMessageException
- if there was an error.SmackException.NotConnectedException
- if the XMPP connection is not connected.SmackException.NoResponseException
- if there was no response from the remote entity.
-
establish
protected void establish(Socket socket) throws IOException, SmackException.SmackMessageException
Initializes the connection to the SOCKS5 proxy by negotiating authentication method and requesting a stream for the given digest. Currently only the no-authentication method is supported by the Socks5Client.- Parameters:
socket
- connected to a SOCKS5 proxy- Throws:
IOException
- if an I/O error occurred.SmackException.SmackMessageException
- if there was an error.
-
-