Home / Function/ testIDNEncodeToAsciiForDomain() — netty Function Reference

testIDNEncodeToAsciiForDomain() — netty Function Reference

Architecture documentation for the testIDNEncodeToAsciiForDomain() function in SocksCmdResponseTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  a5c6419a_8896_51fc_81cd_2d352724ba68["testIDNEncodeToAsciiForDomain()"]
  759f4396_b47c_b08f_fc0d_7ab762d522b4["SocksCmdResponseTest"]
  a5c6419a_8896_51fc_81cd_2d352724ba68 -->|defined in| 759f4396_b47c_b08f_fc0d_7ab762d522b4
  style a5c6419a_8896_51fc_81cd_2d352724ba68 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-socks/src/test/java/io/netty/handler/codec/socks/SocksCmdResponseTest.java lines 142–165

    @Test
    public void testIDNEncodeToAsciiForDomain() {
        String host = "тест.рф";
        CharBuffer asciiHost = CharBuffer.wrap(IDN.toASCII(host));
        short port = 10000;

        SocksCmdResponse rs = new SocksCmdResponse(SocksCmdStatus.SUCCESS, SocksAddressType.DOMAIN, host, port);
        assertEquals(host, rs.host());

        ByteBuf buffer = Unpooled.buffer(24);
        rs.encodeAsByteBuf(buffer);

        buffer.resetReaderIndex();
        assertEquals(SocksProtocolVersion.SOCKS5.byteValue(), buffer.readByte());
        assertEquals(SocksCmdStatus.SUCCESS.byteValue(), buffer.readByte());
        assertEquals((byte) 0x00, buffer.readByte());
        assertEquals(SocksAddressType.DOMAIN.byteValue(), buffer.readByte());
        assertEquals((byte) asciiHost.length(), buffer.readUnsignedByte());
        assertEquals(asciiHost,
            CharBuffer.wrap(buffer.readCharSequence(asciiHost.length(), CharsetUtil.US_ASCII)));
        assertEquals(port, buffer.readUnsignedShort());

        buffer.release();
    }

Domain

Subdomains

Frequently Asked Questions

What does testIDNEncodeToAsciiForDomain() do?
testIDNEncodeToAsciiForDomain() is a function in the netty codebase, defined in codec-socks/src/test/java/io/netty/handler/codec/socks/SocksCmdResponseTest.java.
Where is testIDNEncodeToAsciiForDomain() defined?
testIDNEncodeToAsciiForDomain() is defined in codec-socks/src/test/java/io/netty/handler/codec/socks/SocksCmdResponseTest.java at line 142.

Analyze Your Own Codebase

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

Try Supermodel Free