Class Socks5PrivateAuthResponseDecoder

java.lang.Object
All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler

public final class Socks5PrivateAuthResponseDecoder extends ByteToMessageDecoder
Decodes a single Socks5PrivateAuthResponse from the inbound ByteBufs. On successful decode, this decoder will forward the received data to the next handler, so that other handler can remove or replace this decoder later. On failed decode, this decoder will discard the received data, so that other handler closes the connection later.

The default format follows a simple structure:

  • 1 byte: version (must be 1)
  • 1 byte: status (0x00 for success, 0xFF for failure)

For custom private authentication protocols, you can:

  • Field Details

  • Constructor Details

    • Socks5PrivateAuthResponseDecoder

      public Socks5PrivateAuthResponseDecoder()
  • Method Details

    • decode

      protected void decode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out) throws java.lang.Exception
      Description copied from class: ByteToMessageDecoder
      Decode the from one ByteBuf to an other. This method will be called till either the input ByteBuf has nothing to read when return from this method or till nothing was read from the input ByteBuf.
      Specified by:
      decode in class ByteToMessageDecoder
      Parameters:
      ctx - the ChannelHandlerContext which this ByteToMessageDecoder belongs to
      in - the ByteBuf from which to read data
      out - the List to which decoded messages should be added
      Throws:
      java.lang.Exception - is thrown if an error occurs
    • fail

      private void fail(java.util.List<java.lang.Object> out, java.lang.Exception cause)
      Handles decoder failures by setting the appropriate error state.
      Parameters:
      out - the output list to add the failure message to
      cause - the exception that caused the failure