Class SocksProxyProtocolHandler

  • All Implemented Interfaces:
    IOEventHandler

    final class SocksProxyProtocolHandler
    extends java.lang.Object
    implements IOEventHandler
    Implements the client side of SOCKS protocol version 5 as per https://tools.ietf.org/html/rfc1928. Supports SOCKS username/password authentication as per https://tools.ietf.org/html/rfc1929.
    • Method Detail

      • connected

        public void connected​(IOSession session)
                       throws java.io.IOException
        Description copied from interface: IOEventHandler
        Triggered after the given session has been just created.
        Specified by:
        connected in interface IOEventHandler
        Parameters:
        session - the I/O session.
        Throws:
        java.io.IOException
      • outputReady

        public void outputReady​(IOSession session)
                         throws java.io.IOException
        Description copied from interface: IOEventHandler
        Triggered when the given session is ready for output.
        Specified by:
        outputReady in interface IOEventHandler
        Parameters:
        session - the I/O session.
        Throws:
        java.io.IOException
      • cred

        private byte[] cred​(java.lang.String cred)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • inputReady

        public void inputReady​(IOSession session,
                               java.nio.ByteBuffer src)
                        throws java.io.IOException
        Description copied from interface: IOEventHandler
        Triggered when the given session has input pending.
        Specified by:
        inputReady in interface IOEventHandler
        Parameters:
        session - the I/O session.
        Throws:
        java.io.IOException
      • prepareConnectCommand

        private void prepareConnectCommand()
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • setBufferLimit

        private void setBufferLimit​(int newLimit)
      • writeAndPrepareRead

        private boolean writeAndPrepareRead​(java.nio.channels.ByteChannel channel,
                                            int readSize)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • writeBuffer

        private boolean writeBuffer​(java.nio.channels.ByteChannel channel)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • fillBuffer

        private boolean fillBuffer​(java.nio.channels.ByteChannel channel)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • timeout

        public void timeout​(IOSession session,
                            Timeout timeout)
                     throws java.io.IOException
        Description copied from interface: IOEventHandler
        Triggered when the given session has timed out.
        Specified by:
        timeout in interface IOEventHandler
        Parameters:
        session - the I/O session.
        timeout - the timeout.
        Throws:
        java.io.IOException
      • exception

        public void exception​(IOSession session,
                              java.lang.Exception cause)
        Description copied from interface: IOEventHandler
        Triggered when the given session throws a exception.
        Specified by:
        exception in interface IOEventHandler
        Parameters:
        session - the I/O session.
      • disconnected

        public void disconnected​(IOSession session)
        Description copied from interface: IOEventHandler
        Triggered when the given session has been terminated.
        Specified by:
        disconnected in interface IOEventHandler
        Parameters:
        session - the I/O session.