Class Socks5ProxyHandler

    • Constructor Detail

      • Socks5ProxyHandler

        public Socks5ProxyHandler​(java.net.SocketAddress proxyAddress)
      • Socks5ProxyHandler

        public Socks5ProxyHandler​(java.net.SocketAddress proxyAddress,
                                  java.lang.String username,
                                  java.lang.String password)
      • Socks5ProxyHandler

        public Socks5ProxyHandler​(java.net.SocketAddress proxyAddress,
                                  byte privateAuthMethod,
                                  byte[] privateToken,
                                  Socks5ClientEncoder customEncoder)
        Creates a new SOCKS5 proxy handler with a custom private authentication method.
        Parameters:
        proxyAddress - The address of the SOCKS5 proxy server
        privateAuthMethod - The private authentication method code (must be in range 0x80-0xFE)
        privateToken - The token to use for private authentication
        customEncoder - The custom encoder to use for encoding SOCKS5 messages, if null the Socks5ClientEncoder.DEFAULT will be used
        Throws:
        java.lang.IllegalArgumentException - If privateAuthMethod is not in the valid range
    • Method Detail

      • protocol

        public java.lang.String protocol()
        Description copied from class: ProxyHandler
        Returns the name of the proxy protocol in use.
        Specified by:
        protocol in class ProxyHandler
      • authScheme

        public java.lang.String authScheme()
        Description copied from class: ProxyHandler
        Returns the name of the authentication scheme in use.
        Specified by:
        authScheme in class ProxyHandler
      • username

        public java.lang.String username()
      • password

        public java.lang.String password()
      • addCodec

        protected void addCodec​(ChannelHandlerContext ctx)
                         throws java.lang.Exception
        Description copied from class: ProxyHandler
        Adds the codec handlers required to communicate with the proxy server.
        Specified by:
        addCodec in class ProxyHandler
        Throws:
        java.lang.Exception
      • newInitialMessage

        protected java.lang.Object newInitialMessage​(ChannelHandlerContext ctx)
                                              throws java.lang.Exception
        Description copied from class: ProxyHandler
        Returns a new message that is sent at first time when the connection to the proxy server has been established.
        Specified by:
        newInitialMessage in class ProxyHandler
        Returns:
        the initial message, or null if the proxy server is expected to send the first message instead
        Throws:
        java.lang.Exception
      • handleResponse

        protected boolean handleResponse​(ChannelHandlerContext ctx,
                                         java.lang.Object response)
                                  throws java.lang.Exception
        Description copied from class: ProxyHandler
        Handles the message received from the proxy server.
        Specified by:
        handleResponse in class ProxyHandler
        Returns:
        true if the connection to the destination has been established, false if the connection to the destination has not been established and more messages are expected from the proxy server
        Throws:
        java.lang.Exception