Home / Class/ Socks4ServerDecoderTest Class — netty Architecture

Socks4ServerDecoderTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  7cac8956_3020_1100_4d53_6843a8dfe96d["Socks4ServerDecoderTest"]
  a0d31c85_bfaa_09a4_c1f6_22257b13ee6f["Socks4ServerDecoderTest.java"]
  7cac8956_3020_1100_4d53_6843a8dfe96d -->|defined in| a0d31c85_bfaa_09a4_c1f6_22257b13ee6f
  c611c50a_ff30_f091_bbb7_450bf6d44752["test()"]
  7cac8956_3020_1100_4d53_6843a8dfe96d -->|method| c611c50a_ff30_f091_bbb7_450bf6d44752
  b2a07317_20a8_0e90_5849_223ec88a56c3["testCmdRequestDecoder()"]
  7cac8956_3020_1100_4d53_6843a8dfe96d -->|method| b2a07317_20a8_0e90_5849_223ec88a56c3

Relationship Graph

Source Code

codec-socks/src/test/java/io/netty/handler/codec/socksx/v4/Socks4ServerDecoderTest.java lines 29–65

public class Socks4ServerDecoderTest {
    private static final InternalLogger logger = InternalLoggerFactory.getInstance(Socks4ServerDecoderTest.class);

    private static void test(String userId, Socks4CommandType type, String dstAddr, int dstPort) {
        logger.debug(
                "Testing type: " + type + " dstAddr: " + dstAddr + " dstPort: " + dstPort +
                " userId: " + userId);

        Socks4CommandRequest msg = new DefaultSocks4CommandRequest(type, dstAddr, dstPort, userId);
        EmbeddedChannel embedder = new EmbeddedChannel(new Socks4ServerDecoder());
        Socks4CommonTestUtils.writeMessageIntoEmbedder(embedder, msg);
        msg = embedder.readInbound();
        assertSame(msg.type(), type);
        assertEquals(msg.dstAddr(), dstAddr);
        assertEquals(msg.dstPort(), dstPort);
        assertEquals(msg.userId(), userId);
        assertNull(embedder.readInbound());
    }

    @Test
    public void testCmdRequestDecoder() {
        String[] hosts = { "127.0.0.1", };
        String[] userIds = { "test", };
        int[] ports = {1, 32769, 65535};

        for (Socks4CommandType cmdType : Arrays.asList(Socks4CommandType.BIND,
                                                       Socks4CommandType.CONNECT)) {
            for (String userId : userIds) {
                for (String host : hosts) {
                    for (int port : ports) {
                        test(userId, cmdType, host, port);
                    }
                }
            }
        }
    }
}

Frequently Asked Questions

What is the Socks4ServerDecoderTest class?
Socks4ServerDecoderTest is a class in the netty codebase, defined in codec-socks/src/test/java/io/netty/handler/codec/socksx/v4/Socks4ServerDecoderTest.java.
Where is Socks4ServerDecoderTest defined?
Socks4ServerDecoderTest is defined in codec-socks/src/test/java/io/netty/handler/codec/socksx/v4/Socks4ServerDecoderTest.java at line 29.

Analyze Your Own Codebase

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

Try Supermodel Free