Class Socks5Client

  • Direct Known Subclasses:
    Socks5ClientForInitiator

    public class Socks5Client
    extends java.lang.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.
    • Constructor Summary

      Constructors 
      Constructor Description
      Socks5Client​(Bytestream.StreamHost streamHost, java.lang.String digest)
      Constructor for a SOCKS5 client.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void establish​(java.net.Socket socket)
      Initializes the connection to the SOCKS5 proxy by negotiating authentication method and requesting a stream for the given digest.
      java.net.Socket getSocket​(int timeout)
      Returns the initialized socket that can be used to transfer data between peers via the SOCKS5 proxy.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Socks5Client

        public Socks5Client​(Bytestream.StreamHost streamHost,
                            java.lang.String digest)
        Constructor for a SOCKS5 client.
        Parameters:
        streamHost - containing network settings of the SOCKS5 proxy
        digest - identifying the SOCKS5 Bytestream
    • Method Detail

      • getSocket

        public java.net.Socket getSocket​(int timeout)
                                  throws java.io.IOException,
                                         java.lang.InterruptedException,
                                         java.util.concurrent.TimeoutException,
                                         org.jivesoftware.smack.XMPPException,
                                         org.jivesoftware.smack.SmackException.SmackMessageException,
                                         org.jivesoftware.smack.SmackException.NotConnectedException,
                                         org.jivesoftware.smack.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:
        java.io.IOException - if initializing the socket failed due to a network error
        java.util.concurrent.TimeoutException - if connecting to SOCKS5 proxy timed out
        java.lang.InterruptedException - if the current thread was interrupted while waiting
        org.jivesoftware.smack.XMPPException - if an XMPP protocol error was received.
        org.jivesoftware.smack.SmackException.SmackMessageException - if there was an error.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
      • establish

        protected void establish​(java.net.Socket socket)
                          throws java.io.IOException,
                                 org.jivesoftware.smack.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:
        java.io.IOException - if an I/O error occurred.
        org.jivesoftware.smack.SmackException.SmackMessageException - if there was an error.