Top Description Fields Constructors Methods
io.netty.contrib.handler.codec.socksx.v5

public Class Socks5ClientEncoder

extends MessageToByteEncoder<Socks5Message>
Class Inheritance
Imports
io.netty5.buffer.Buffer, io.netty5.channel.ChannelHandlerContext, io.netty5.handler.codec.EncoderException, .MessageToByteEncoder, java.nio.charset.StandardCharsets, io.netty5.util.internal.StringUtil, java.util.List, .RandomAccess

Encodes a client-side Socks5Message into a Buffer.

Field Summary

Modifier and TypeField and Description
private final Socks5AddressEncoder
public static final Socks5ClientEncoder

Constructor Summary

AccessConstructor and Description
protected
Socks5ClientEncoder()

Creates a new instance with the default Socks5AddressEncoder.

public
Socks5ClientEncoder(Socks5AddressEncoder addressEncoder)

Creates a new instance with the specified Socks5AddressEncoder.

Method Summary

Modifier and TypeMethod and Description
protected final Socks5AddressEncoder
addressEncoder()

Returns the Socks5AddressEncoder of this encoder.

protected Buffer
allocateBuffer(ChannelHandlerContext ctx, Socks5Message
the message to be encoded
msg
)

Implements abstract io.netty5.handler.codec.MessageToByteEncoder.allocateBuffer.

Allocate a Buffer which will be used as argument of encode(ChannelHandlerContext, I, Buffer).
protected void
encode(ChannelHandlerContext ctx, Socks5Message
the message to encode
msg
,
Buffer
the Buffer into which the encoded message will be written
out
)

Implements abstract io.netty5.handler.codec.MessageToByteEncoder.encode.

Encode a message into a Buffer.
private static void
private void
private static void
public boolean
isSharable()

Overrides default io.netty5.channel.ChannelHandler.isSharable.

Returns true if this handler is sharable and thus can be added to more than one ChannelPipeline.
Inherited from io.netty5.handler.codec.MessageToByteEncoder:
acceptOutboundMessagewrite

Field Detail

addressEncoderback to summary
private final Socks5AddressEncoder addressEncoder
DEFAULTback to summary
public static final Socks5ClientEncoder DEFAULT

Constructor Detail

Socks5ClientEncoderback to summary
protected Socks5ClientEncoder()

Creates a new instance with the default Socks5AddressEncoder.

Socks5ClientEncoderback to summary
public Socks5ClientEncoder(Socks5AddressEncoder addressEncoder)

Creates a new instance with the specified Socks5AddressEncoder.

Method Detail

addressEncoderback to summary
protected final Socks5AddressEncoder addressEncoder()

Returns the Socks5AddressEncoder of this encoder.

allocateBufferback to summary
protected Buffer allocateBuffer(ChannelHandlerContext ctx, Socks5Message msg)

Implements abstract io.netty5.handler.codec.MessageToByteEncoder.allocateBuffer.

Doc from io.netty5.handler.codec.MessageToByteEncoder.allocateBuffer.

Allocate a Buffer which will be used as argument of encode(ChannelHandlerContext, I, Buffer).

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this MessageToByteEncoder belongs to

msg:Socks5Message

the message to be encoded

Annotations
@Override
encodeback to summary
protected void encode(ChannelHandlerContext ctx, Socks5Message msg, Buffer out) throws Exception

Implements abstract io.netty5.handler.codec.MessageToByteEncoder.encode.

Doc from io.netty5.handler.codec.MessageToByteEncoder.encode.

Encode a message into a Buffer. This method will be called for each written message that can be handled by this encoder.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this MessageToByteEncoder belongs to

msg:Socks5Message

the message to encode

out:Buffer

the Buffer into which the encoded message will be written

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
encodeAuthMethodRequestback to summary
private static void encodeAuthMethodRequest(Socks5InitialRequest msg, Buffer out)
encodeCommandRequestback to summary
private void encodeCommandRequest(Socks5CommandRequest msg, Buffer out) throws Exception
encodePasswordAuthRequestback to summary
private static void encodePasswordAuthRequest(Socks5PasswordAuthRequest msg, Buffer out)
isSharableback to summary
public boolean isSharable()

Overrides default io.netty5.channel.ChannelHandler.isSharable.

Doc from io.netty5.channel.ChannelHandler.isSharable.

Returns true if this handler is sharable and thus can be added to more than one ChannelPipeline. By default, this method returns false. If this method returns false, you have to create a new handler instance every time you add it to a pipeline because it has unshared state such as member variables.

Annotations
@Override