Home / Function/ testEndianessForPort() — netty Function Reference

testEndianessForPort() — netty Function Reference

Architecture documentation for the testEndianessForPort() function in SocksCmdRequestTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  abdbe1d1_e5d5_befe_ba16_d30ef4d51393["testEndianessForPort()"]
  40e986d6_a601_2eef_0944_4ce79e241e60["SocksCmdRequestTest"]
  abdbe1d1_e5d5_befe_ba16_d30ef4d51393 -->|defined in| 40e986d6_a601_2eef_0944_4ce79e241e60
  style abdbe1d1_e5d5_befe_ba16_d30ef4d51393 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-socks/src/test/java/io/netty/handler/codec/socks/SocksCmdRequestTest.java lines 131–153

    @Test
    public void testEndianessForPort() {
        String host = "localhost";
        CharBuffer asciiHost = CharBuffer.wrap(host);
        short port = 10000;

        SocksCmdRequest rq = new SocksCmdRequest(SocksCmdType.BIND, SocksAddressType.DOMAIN, host, port);
        assertEquals(host, rq.host());

        ByteBuf buffer = Unpooled.buffer(24).order(ByteOrder.LITTLE_ENDIAN);
        rq.encodeAsByteBuf(buffer);

        assertEquals(SocksProtocolVersion.SOCKS5.byteValue(), buffer.readByte());
        assertEquals(SocksCmdType.BIND.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, ByteBufUtil.readUnsignedShortBE(buffer));

        buffer.release();
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free