Socks5PasswordAuthResponseDecoder Class — netty Architecture
Architecture documentation for the Socks5PasswordAuthResponseDecoder class in Socks5PasswordAuthResponseDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 687ba40c_a71c_d4c6_22c5_eee31c2f27b5["Socks5PasswordAuthResponseDecoder"] ec09aeba_54ac_8769_4cf5_4d8ed1bbbb4a["Socks5PasswordAuthResponseDecoder.java"] 687ba40c_a71c_d4c6_22c5_eee31c2f27b5 -->|defined in| ec09aeba_54ac_8769_4cf5_4d8ed1bbbb4a e6112959_2a34_ae96_fc5a_66c917f3f3b4["Socks5PasswordAuthResponseDecoder()"] 687ba40c_a71c_d4c6_22c5_eee31c2f27b5 -->|method| e6112959_2a34_ae96_fc5a_66c917f3f3b4 a7a929a6_3a60_1d5b_e630_f82adb27c24a["decode()"] 687ba40c_a71c_d4c6_22c5_eee31c2f27b5 -->|method| a7a929a6_3a60_1d5b_e630_f82adb27c24a 612e78d9_7c69_f5ec_0a3e_c669e9ccd6ee["fail()"] 687ba40c_a71c_d4c6_22c5_eee31c2f27b5 -->|method| 612e78d9_7c69_f5ec_0a3e_c669e9ccd6ee
Relationship Graph
Source Code
codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5PasswordAuthResponseDecoder.java lines 35–89
public class Socks5PasswordAuthResponseDecoder extends ReplayingDecoder<State> {
@UnstableApi
public enum State {
INIT,
SUCCESS,
FAILURE
}
public Socks5PasswordAuthResponseDecoder() {
super(State.INIT);
}
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
try {
switch (state()) {
case INIT: {
final byte version = in.readByte();
if (version != 1) {
throw new DecoderException("unsupported subnegotiation version: " + version + " (expected: 1)");
}
out.add(new DefaultSocks5PasswordAuthResponse(Socks5PasswordAuthStatus.valueOf(in.readByte())));
checkpoint(State.SUCCESS);
}
case SUCCESS: {
int readableBytes = actualReadableBytes();
if (readableBytes > 0) {
out.add(in.readRetainedSlice(readableBytes));
}
break;
}
case FAILURE: {
in.skipBytes(actualReadableBytes());
break;
}
}
} catch (Exception e) {
fail(out, e);
}
}
private void fail(List<Object> out, Exception cause) {
if (!(cause instanceof DecoderException)) {
cause = new DecoderException(cause);
}
checkpoint(State.FAILURE);
Socks5Message m = new DefaultSocks5PasswordAuthResponse(Socks5PasswordAuthStatus.FAILURE);
m.setDecoderResult(DecoderResult.failure(cause));
out.add(m);
}
}
Defined In
Source
Frequently Asked Questions
What is the Socks5PasswordAuthResponseDecoder class?
Socks5PasswordAuthResponseDecoder is a class in the netty codebase, defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5PasswordAuthResponseDecoder.java.
Where is Socks5PasswordAuthResponseDecoder defined?
Socks5PasswordAuthResponseDecoder is defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5PasswordAuthResponseDecoder.java at line 35.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free