handleResponse() — netty Function Reference
Architecture documentation for the handleResponse() function in Socks5ProxyHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD c0259981_07c5_5878_5f82_f3d8674742ec["handleResponse()"] 926eac21_d91e_6616_387b_ad05731b49a5["Socks5ProxyHandler"] c0259981_07c5_5878_5f82_f3d8674742ec -->|defined in| 926eac21_d91e_6616_387b_ad05731b49a5 ab6a5019_0df9_7148_fbe1_714574730408["sendConnectCommand()"] c0259981_07c5_5878_5f82_f3d8674742ec -->|calls| ab6a5019_0df9_7148_fbe1_714574730408 style c0259981_07c5_5878_5f82_f3d8674742ec fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
handler-proxy/src/main/java/io/netty/handler/proxy/Socks5ProxyHandler.java lines 184–242
@Override
protected boolean handleResponse(ChannelHandlerContext ctx, Object response) throws Exception {
if (response instanceof Socks5InitialResponse) {
Socks5InitialResponse res = (Socks5InitialResponse) response;
Socks5AuthMethod authMethod = socksAuthMethod();
Socks5AuthMethod resAuthMethod = res.authMethod();
if (resAuthMethod != Socks5AuthMethod.NO_AUTH && resAuthMethod != authMethod
&& !Socks5AuthMethod.isPrivateMethod(resAuthMethod.byteValue())) {
// Server did not allow unauthenticated access nor accept the requested authentication scheme.
throw new ProxyConnectException(exceptionMessage("unexpected authMethod: " + res.authMethod()));
}
if (resAuthMethod == Socks5AuthMethod.NO_AUTH) {
sendConnectCommand(ctx);
} else if (resAuthMethod == Socks5AuthMethod.PASSWORD) {
// In case of password authentication, send an authentication request.
ctx.pipeline().replace(decoderName, decoderName, new Socks5PasswordAuthResponseDecoder());
sendToProxyServer(new DefaultSocks5PasswordAuthRequest(
username != null? username : "", password != null? password : ""));
} else if (Socks5AuthMethod.isPrivateMethod(resAuthMethod.byteValue())) {
ctx.pipeline().replace(decoderName, decoderName, new Socks5PrivateAuthResponseDecoder());
sendToProxyServer(new DefaultSocks5PrivateAuthRequest(privateToken));
} else {
// Should never reach here.
throw new Error("Unexpected authMethod: " + resAuthMethod);
}
return false;
}
if (response instanceof Socks5PasswordAuthResponse) {
// Received an authentication response from the server.
Socks5PasswordAuthResponse res = (Socks5PasswordAuthResponse) response;
if (res.status() != Socks5PasswordAuthStatus.SUCCESS) {
throw new ProxyConnectException(exceptionMessage("authStatus: " + res.status()));
}
sendConnectCommand(ctx);
return false;
}
if (response instanceof Socks5PrivateAuthResponse) {
Socks5PrivateAuthResponse res = (Socks5PrivateAuthResponse) response;
if (res.status() != Socks5PrivateAuthStatus.SUCCESS) {
throw new ProxyConnectException(exceptionMessage("privateAuthStatus: " + res.status()));
}
sendConnectCommand(ctx);
return false;
}
// This should be the last message from the server.
Socks5CommandResponse res = (Socks5CommandResponse) response;
if (res.status() != Socks5CommandStatus.SUCCESS) {
throw new ProxyConnectException(exceptionMessage("status: " + res.status()));
}
return true;
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does handleResponse() do?
handleResponse() is a function in the netty codebase, defined in handler-proxy/src/main/java/io/netty/handler/proxy/Socks5ProxyHandler.java.
Where is handleResponse() defined?
handleResponse() is defined in handler-proxy/src/main/java/io/netty/handler/proxy/Socks5ProxyHandler.java at line 184.
What does handleResponse() call?
handleResponse() calls 1 function(s): sendConnectCommand.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free