SocksCmdRequestDecoderTest Class — netty Architecture
Architecture documentation for the SocksCmdRequestDecoderTest class in SocksCmdRequestDecoderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD b310d236_86c5_c256_55ec_07e2514edd9f["SocksCmdRequestDecoderTest"] e2ad9f38_c97a_4391_a2ca_1881f87a9f19["SocksCmdRequestDecoderTest.java"] b310d236_86c5_c256_55ec_07e2514edd9f -->|defined in| e2ad9f38_c97a_4391_a2ca_1881f87a9f19 6e40a760_b5e1_a0ac_d9e7_a4b3ac495a1a["testSocksCmdRequestDecoderWithDifferentParams()"] b310d236_86c5_c256_55ec_07e2514edd9f -->|method| 6e40a760_b5e1_a0ac_d9e7_a4b3ac495a1a d971d68f_ae7f_5c02_6f9f_f79297f8f9f9["testCmdRequestDecoderIPv4()"] b310d236_86c5_c256_55ec_07e2514edd9f -->|method| d971d68f_ae7f_5c02_6f9f_f79297f8f9f9 fab42f80_bda0_c333_66a5_a27202121ec4["testCmdRequestDecoderIPv6()"] b310d236_86c5_c256_55ec_07e2514edd9f -->|method| fab42f80_bda0_c333_66a5_a27202121ec4 c432bb15_69b6_6e02_474e_0ffc32f541ef["testCmdRequestDecoderDomain()"] b310d236_86c5_c256_55ec_07e2514edd9f -->|method| c432bb15_69b6_6e02_474e_0ffc32f541ef 4f7701c4_c706_1c1c_da7d_a0844154dee0["testCmdRequestDecoderUnknown()"] b310d236_86c5_c256_55ec_07e2514edd9f -->|method| 4f7701c4_c706_1c1c_da7d_a0844154dee0
Relationship Graph
Source Code
codec-socks/src/test/java/io/netty/handler/codec/socks/SocksCmdRequestDecoderTest.java lines 31–114
public class SocksCmdRequestDecoderTest {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(SocksCmdRequestDecoderTest.class);
private static void testSocksCmdRequestDecoderWithDifferentParams(SocksCmdType cmdType,
SocksAddressType addressType,
String host,
int port) {
logger.debug("Testing cmdType: " + cmdType + " addressType: " + addressType + " host: " + host +
" port: " + port);
SocksCmdRequest msg = new SocksCmdRequest(cmdType, addressType, host, port);
SocksCmdRequestDecoder decoder = new SocksCmdRequestDecoder();
EmbeddedChannel embedder = new EmbeddedChannel(decoder);
SocksCommonTestUtils.writeMessageIntoEmbedder(embedder, msg);
if (msg.addressType() == SocksAddressType.UNKNOWN) {
assertTrue(embedder.readInbound() instanceof UnknownSocksRequest);
} else {
msg = embedder.readInbound();
assertSame(msg.cmdType(), cmdType);
assertSame(msg.addressType(), addressType);
assertEquals(msg.host(), host);
assertEquals(msg.port(), port);
}
assertNull(embedder.readInbound());
}
@Test
public void testCmdRequestDecoderIPv4() {
String[] hosts = {"127.0.0.1", };
int[] ports = {1, 32769, 65535 };
for (SocksCmdType cmdType : SocksCmdType.values()) {
for (String host : hosts) {
for (int port : ports) {
testSocksCmdRequestDecoderWithDifferentParams(cmdType, SocksAddressType.IPv4, host, port);
}
}
}
}
@Test
public void testCmdRequestDecoderIPv6() throws UnknownHostException {
String[] hosts = {SocksCommonUtils.ipv6toStr(SocketUtils.addressByName("::1").getAddress())};
int[] ports = {1, 32769, 65535};
for (SocksCmdType cmdType : SocksCmdType.values()) {
for (String host : hosts) {
for (int port : ports) {
testSocksCmdRequestDecoderWithDifferentParams(cmdType, SocksAddressType.IPv6, host, port);
}
}
}
}
@Test
public void testCmdRequestDecoderDomain() {
String[] hosts = {"google.com" ,
"مثال.إختبار",
"παράδειγμα.δοκιμή",
"مثال.آزمایشی",
"пример.испытание",
"בײַשפּיל.טעסט",
"例子.测试",
"例子.測試",
"उदाहरण.परीक्षा",
"例え.テスト",
"실례.테스트",
"உதாரணம்.பரிட்சை"};
int[] ports = {1, 32769, 65535};
for (SocksCmdType cmdType : SocksCmdType.values()) {
for (String host : hosts) {
for (int port : ports) {
testSocksCmdRequestDecoderWithDifferentParams(cmdType, SocksAddressType.DOMAIN, host, port);
}
}
}
}
@Test
public void testCmdRequestDecoderUnknown() {
String host = "google.com";
int port = 80;
for (SocksCmdType cmdType : SocksCmdType.values()) {
testSocksCmdRequestDecoderWithDifferentParams(cmdType, SocksAddressType.UNKNOWN, host, port);
Source
Frequently Asked Questions
What is the SocksCmdRequestDecoderTest class?
SocksCmdRequestDecoderTest is a class in the netty codebase, defined in codec-socks/src/test/java/io/netty/handler/codec/socks/SocksCmdRequestDecoderTest.java.
Where is SocksCmdRequestDecoderTest defined?
SocksCmdRequestDecoderTest is defined in codec-socks/src/test/java/io/netty/handler/codec/socks/SocksCmdRequestDecoderTest.java at line 31.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free