Home / Function/ testEncodeLocalProxyV2() — netty Function Reference

testEncodeLocalProxyV2() — netty Function Reference

Architecture documentation for the testEncodeLocalProxyV2() function in HaProxyMessageEncoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ed29d1ab_c11b_57b9_021c_7333f4f6f145["testEncodeLocalProxyV2()"]
  4545ac9d_2f62_4ac7_c80f_5975d8175456["HaProxyMessageEncoderTest"]
  ed29d1ab_c11b_57b9_021c_7333f4f6f145 -->|defined in| 4545ac9d_2f62_4ac7_c80f_5975d8175456
  style ed29d1ab_c11b_57b9_021c_7333f4f6f145 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-haproxy/src/test/java/io/netty/handler/codec/haproxy/HaProxyMessageEncoderTest.java lines 329–362

    @Test
    public void testEncodeLocalProxyV2() {
        EmbeddedChannel ch = new EmbeddedChannel(INSTANCE);

        HAProxyMessage message = new HAProxyMessage(
                HAProxyProtocolVersion.V2, HAProxyCommand.LOCAL, HAProxyProxiedProtocol.UNKNOWN,
                null, null, 0, 0);
        assertTrue(ch.writeOutbound(message));

        ByteBuf byteBuf = ch.readOutbound();

        // header
        byte[] headerBytes = new byte[12];
        byteBuf.readBytes(headerBytes);
        assertArrayEquals(BINARY_PREFIX, headerBytes);

        // command
        byte commandByte = byteBuf.readByte();
        assertEquals(0x02, (commandByte & 0xf0) >> 4);
        assertEquals(0x00, commandByte & 0x0f);

        // transport protocol, address family
        byte transportByte = byteBuf.readByte();
        assertEquals(0x00, transportByte);

        // source address length
        int sourceAddrLength = byteBuf.readUnsignedShort();
        assertEquals(0, sourceAddrLength);

        assertFalse(byteBuf.isReadable());

        byteBuf.release();
        assertFalse(ch.finish());
    }

Domain

Subdomains

Frequently Asked Questions

What does testEncodeLocalProxyV2() do?
testEncodeLocalProxyV2() is a function in the netty codebase, defined in codec-haproxy/src/test/java/io/netty/handler/codec/haproxy/HaProxyMessageEncoderTest.java.
Where is testEncodeLocalProxyV2() defined?
testEncodeLocalProxyV2() is defined in codec-haproxy/src/test/java/io/netty/handler/codec/haproxy/HaProxyMessageEncoderTest.java at line 329.

Analyze Your Own Codebase

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

Try Supermodel Free