Home / Class/ Socks4IntermediaryHandler Class — netty Architecture

Socks4IntermediaryHandler Class — netty Architecture

Architecture documentation for the Socks4IntermediaryHandler class in Socks4ProxyServer.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0fe3f240_8dbf_ae00_6628_30dfeca43c96["Socks4IntermediaryHandler"]
  35a44061_021b_aedc_780f_0592677af7d8["Socks4ProxyServer.java"]
  0fe3f240_8dbf_ae00_6628_30dfeca43c96 -->|defined in| 35a44061_021b_aedc_780f_0592677af7d8
  a35fdca2_34a5_93ee_8df6_a105404d182a["handleProxyProtocol()"]
  0fe3f240_8dbf_ae00_6628_30dfeca43c96 -->|method| a35fdca2_34a5_93ee_8df6_a105404d182a
  728b498d_1b94_3475_54ec_36b725da91c6["SocketAddress()"]
  0fe3f240_8dbf_ae00_6628_30dfeca43c96 -->|method| 728b498d_1b94_3475_54ec_36b725da91c6

Relationship Graph

Source Code

handler-proxy/src/test/java/io/netty/handler/proxy/Socks4ProxyServer.java lines 85–113

    private final class Socks4IntermediaryHandler extends IntermediaryHandler {

        private SocketAddress intermediaryDestination;

        @Override
        protected boolean handleProxyProtocol(ChannelHandlerContext ctx, Object msg) throws Exception {
            Socks4CommandRequest req = (Socks4CommandRequest) msg;
            Socks4CommandResponse res;

            if (!authenticate(ctx, req)) {
                res = new DefaultSocks4CommandResponse(Socks4CommandStatus.IDENTD_AUTH_FAILURE);
            } else {
                res = new DefaultSocks4CommandResponse(Socks4CommandStatus.SUCCESS);
                intermediaryDestination = SocketUtils.socketAddress(req.dstAddr(), req.dstPort());
            }

            ctx.write(res);

            ctx.pipeline().remove(Socks4ServerDecoder.class);
            ctx.pipeline().remove(Socks4ServerEncoder.class);

            return true;
        }

        @Override
        protected SocketAddress intermediaryDestination() {
            return intermediaryDestination;
        }
    }

Frequently Asked Questions

What is the Socks4IntermediaryHandler class?
Socks4IntermediaryHandler is a class in the netty codebase, defined in handler-proxy/src/test/java/io/netty/handler/proxy/Socks4ProxyServer.java.
Where is Socks4IntermediaryHandler defined?
Socks4IntermediaryHandler is defined in handler-proxy/src/test/java/io/netty/handler/proxy/Socks4ProxyServer.java at line 85.

Analyze Your Own Codebase

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

Try Supermodel Free