public void test_PrivateLink()

in proprot/tst/com/amazonaws/proprot/Compatibility_AwsNetworkLoadBalancerTest.java [40:89]


    public void test_PrivateLink() throws IOException {
        byte expected_content[] = {
                0x0d, 0x0a, 0x0d, 0x0a, /* Start of Sig */
                0x00, 0x0d, 0x0a, 0x51,
                0x55, 0x49, 0x54, 0x0a, /* End of Sig */
                0x21, 0x11, 0x00, 0x54, /* ver_cmd, fam and len */
                (byte) 0xac, 0x1f, 0x07, 0x71, /* Caller src ip */
                (byte) 0xac, 0x1f, 0x0a, 0x1f, /* Endpoint dst ip */
                (byte) 0xc8, (byte) 0xf2, 0x00, 0x50, /* Proxy src port & dst port */
                0x03, 0x00, 0x04, (byte) 0xe8, /* CRC TLV start */
                (byte) 0xd6, (byte) 0x89, 0x2d, (byte) 0xea, /* CRC TLV cont, VPCE id TLV start */
                0x00, 0x17, 0x01, 0x76,
                0x70, 0x63, 0x65, 0x2d,
                0x30, 0x38, 0x64, 0x32,
                0x62, 0x66, 0x31, 0x35,
                0x66, 0x61, 0x63, 0x35,
                0x30, 0x30, 0x31, 0x63,
                0x39, 0x04, 0x00, 0x24, /* VPCE id TLV end, NOOP TLV start*/
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, /* NOOP TLV end */
        };

        ProxyProtocol protocol = new ProxyProtocol();
        ByteArrayInputStream in = new ByteArrayInputStream(expected_content);
        Header header = protocol.read(in);
        assertEquals(AddressFamily.AF_INET, header.getAddressFamily());
        assertEquals(TransportProtocol.STREAM, header.getTransportProtocol());
        assertEquals(Command.PROXY, header.getCommand());
        assertEquals("172.31.7.113", getAddressAsStr(header.getSrcAddress()));
        assertEquals("172.31.10.31", getAddressAsStr(header.getDstAddress()));
        assertEquals(0xC8F2, header.getSrcPort());
        assertEquals(80, header.getDstPort());

        TlvRaw vpceIdTlv = (TlvRaw) Iterables.getOnlyElement(header.getTlvs());
        // PP2_TYPE_AWS (0xEA)
        assertEquals(0xEA, vpceIdTlv.getType());
        byte[] tlvValue = vpceIdTlv.getValue();

        // PP2_SUBTYPE_AWS_VPCE_ID (0x01)
        assertEquals(1, tlvValue[0]);
        byte[] vpceIdValue = Arrays.copyOfRange(tlvValue, 1, tlvValue.length);
        assertArrayEquals("vpce-08d2bf15fac5001c9".getBytes(), vpceIdValue);
    }