Home / Function/ testV2UnknownProtocolDecode() — netty Function Reference

testV2UnknownProtocolDecode() — netty Function Reference

Architecture documentation for the testV2UnknownProtocolDecode() function in HAProxyMessageDecoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  5c0b8cd0_0bb5_46ce_9044_a13406422449["testV2UnknownProtocolDecode()"]
  88909aff_3546_2e28_19d9_812a1929ee17["HAProxyMessageDecoderTest"]
  5c0b8cd0_0bb5_46ce_9044_a13406422449 -->|defined in| 88909aff_3546_2e28_19d9_812a1929ee17
  style 5c0b8cd0_0bb5_46ce_9044_a13406422449 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-haproxy/src/test/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoderTest.java lines 648–702

    @Test
    public void testV2UnknownProtocolDecode() {
        byte[] header = new byte[28];
        header[0] = 0x0D; // Binary Prefix
        header[1] = 0x0A; // -----
        header[2] = 0x0D; // -----
        header[3] = 0x0A; // -----
        header[4] = 0x00; // -----
        header[5] = 0x0D; // -----
        header[6] = 0x0A; // -----
        header[7] = 0x51; // -----
        header[8] = 0x55; // -----
        header[9] = 0x49; // -----
        header[10] = 0x54; // -----
        header[11] = 0x0A; // -----

        header[12] = 0x21; // v2, cmd=PROXY
        header[13] = 0x00; // Unspecified transport protocol and address family

        header[14] = 0x00; // Remaining Bytes
        header[15] = 0x0c; // -----

        header[16] = (byte) 0xc0; // Source Address
        header[17] = (byte) 0xa8; // -----
        header[18] = 0x00; // -----
        header[19] = 0x01; // -----

        header[20] = (byte) 0xc0; // Destination Address
        header[21] = (byte) 0xa8; // -----
        header[22] = 0x00; // -----
        header[23] = 0x0b; // -----

        header[24] = (byte) 0xdc; // Source Port
        header[25] = 0x04; // -----

        header[26] = 0x01; // Destination Port
        header[27] = (byte) 0xbb; // -----

        int startChannels = ch.pipeline().names().size();
        ch.writeInbound(copiedBuffer(header));
        Object msgObj = ch.readInbound();
        assertEquals(startChannels - 1, ch.pipeline().names().size());
        assertThat(msgObj).isInstanceOf(HAProxyMessage.class);
        HAProxyMessage msg = (HAProxyMessage) msgObj;
        assertEquals(HAProxyProtocolVersion.V2, msg.protocolVersion());
        assertEquals(HAProxyCommand.PROXY, msg.command());
        assertEquals(HAProxyProxiedProtocol.UNKNOWN, msg.proxiedProtocol());
        assertNull(msg.sourceAddress());
        assertNull(msg.destinationAddress());
        assertEquals(0, msg.sourcePort());
        assertEquals(0, msg.destinationPort());
        assertNull(ch.readInbound());
        assertFalse(ch.finish());
        assertTrue(msg.release());
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free