Home / Class/ SocksInitResponseDecoder Class — netty Architecture

SocksInitResponseDecoder Class — netty Architecture

Architecture documentation for the SocksInitResponseDecoder class in SocksInitResponseDecoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  821a7187_3037_96e0_8227_4b74449f43b0["SocksInitResponseDecoder"]
  37fd21a8_681b_ca14_494d_e46c3ced5647["SocksInitResponseDecoder.java"]
  821a7187_3037_96e0_8227_4b74449f43b0 -->|defined in| 37fd21a8_681b_ca14_494d_e46c3ced5647
  f27a773a_a2e3_1d65_149c_4e10f4754ea0["SocksInitResponseDecoder()"]
  821a7187_3037_96e0_8227_4b74449f43b0 -->|method| f27a773a_a2e3_1d65_149c_4e10f4754ea0
  2bb2683e_3759_6db4_35fa_762cc1009f99["decode()"]
  821a7187_3037_96e0_8227_4b74449f43b0 -->|method| 2bb2683e_3759_6db4_35fa_762cc1009f99

Relationship Graph

Source Code

codec-socks/src/main/java/io/netty/handler/codec/socks/SocksInitResponseDecoder.java lines 30–63

public class SocksInitResponseDecoder extends ReplayingDecoder<State> {

    public SocksInitResponseDecoder() {
        super(State.CHECK_PROTOCOL_VERSION);
    }

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf byteBuf, List<Object> out) throws Exception {
        switch (state()) {
            case CHECK_PROTOCOL_VERSION: {
                if (byteBuf.readByte() != SocksProtocolVersion.SOCKS5.byteValue()) {
                    out.add(SocksCommonUtils.UNKNOWN_SOCKS_RESPONSE);
                    break;
                }
                checkpoint(State.READ_PREFERRED_AUTH_TYPE);
            }
            case READ_PREFERRED_AUTH_TYPE: {
                SocksAuthScheme authScheme = SocksAuthScheme.valueOf(byteBuf.readByte());
                out.add(new SocksInitResponse(authScheme));
                break;
            }
            default: {
                throw new Error("Unexpected response decoder type: " + state());
            }
        }
        ctx.pipeline().remove(this);
    }

    @UnstableApi
    public enum State {
        CHECK_PROTOCOL_VERSION,
        READ_PREFERRED_AUTH_TYPE
    }
}

Frequently Asked Questions

What is the SocksInitResponseDecoder class?
SocksInitResponseDecoder is a class in the netty codebase, defined in codec-socks/src/main/java/io/netty/handler/codec/socks/SocksInitResponseDecoder.java.
Where is SocksInitResponseDecoder defined?
SocksInitResponseDecoder is defined in codec-socks/src/main/java/io/netty/handler/codec/socks/SocksInitResponseDecoder.java at line 30.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free