testV2WithSslTLVs() — netty Function Reference
Architecture documentation for the testV2WithSslTLVs() function in HAProxyMessageDecoderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 9bfd0107_5516_fc89_e75a_d8762f6a8a49["testV2WithSslTLVs()"] 88909aff_3546_2e28_19d9_812a1929ee17["HAProxyMessageDecoderTest"] 9bfd0107_5516_fc89_e75a_d8762f6a8a49 -->|defined in| 88909aff_3546_2e28_19d9_812a1929ee17 style 9bfd0107_5516_fc89_e75a_d8762f6a8a49 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-haproxy/src/test/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoderTest.java lines 704–765
@Test
public void testV2WithSslTLVs() {
ch = new EmbeddedChannel(new HAProxyMessageDecoder());
final byte[] bytes = {
13, 10, 13, 10, 0, 13, 10, 81, 85, 73, 84, 10, 33, 17, 0, 35, 127, 0, 0, 1, 127, 0, 0, 1,
-55, -90, 7, 89, 32, 0, 20, 5, 0, 0, 0, 0, 33, 0, 5, 84, 76, 83, 118, 49, 34, 0, 4, 76, 69, 65, 70
};
int startChannels = ch.pipeline().names().size();
assertTrue(ch.writeInbound(copiedBuffer(bytes)));
Object msgObj = ch.readInbound();
assertEquals(startChannels - 1, ch.pipeline().names().size());
HAProxyMessage msg = (HAProxyMessage) msgObj;
assertEquals(HAProxyProtocolVersion.V2, msg.protocolVersion());
assertEquals(HAProxyCommand.PROXY, msg.command());
assertEquals(HAProxyProxiedProtocol.TCP4, msg.proxiedProtocol());
assertEquals("127.0.0.1", msg.sourceAddress());
assertEquals("127.0.0.1", msg.destinationAddress());
assertEquals(51622, msg.sourcePort());
assertEquals(1881, msg.destinationPort());
final List<HAProxyTLV> tlvs = msg.tlvs();
assertEquals(3, tlvs.size());
final HAProxyTLV firstTlv = tlvs.get(0);
assertEquals(HAProxyTLV.Type.PP2_TYPE_SSL, firstTlv.type());
final HAProxySSLTLV sslTlv = (HAProxySSLTLV) firstTlv;
assertEquals(0, sslTlv.verify());
assertTrue(sslTlv.isPP2ClientSSL());
assertTrue(sslTlv.isPP2ClientCertSess());
assertFalse(sslTlv.isPP2ClientCertConn());
final HAProxyTLV secondTlv = tlvs.get(1);
assertEquals(HAProxyTLV.Type.PP2_TYPE_SSL_VERSION, secondTlv.type());
ByteBuf secondContentBuf = secondTlv.content();
byte[] secondContent = new byte[secondContentBuf.readableBytes()];
secondContentBuf.readBytes(secondContent);
assertArrayEquals("TLSv1".getBytes(CharsetUtil.US_ASCII), secondContent);
final HAProxyTLV thirdTLV = tlvs.get(2);
assertEquals(HAProxyTLV.Type.PP2_TYPE_SSL_CN, thirdTLV.type());
ByteBuf thirdContentBuf = thirdTLV.content();
byte[] thirdContent = new byte[thirdContentBuf.readableBytes()];
thirdContentBuf.readBytes(thirdContent);
assertArrayEquals("LEAF".getBytes(CharsetUtil.US_ASCII), thirdContent);
assertTrue(sslTlv.encapsulatedTLVs().contains(secondTlv));
assertTrue(sslTlv.encapsulatedTLVs().contains(thirdTLV));
assertTrue(0 < firstTlv.refCnt());
assertTrue(0 < secondTlv.refCnt());
assertTrue(0 < thirdTLV.refCnt());
assertTrue(msg.release());
assertEquals(0, firstTlv.refCnt());
assertEquals(0, secondTlv.refCnt());
assertEquals(0, thirdTLV.refCnt());
assertNull(ch.readInbound());
assertFalse(ch.finish());
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does testV2WithSslTLVs() do?
testV2WithSslTLVs() is a function in the netty codebase, defined in codec-haproxy/src/test/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoderTest.java.
Where is testV2WithSslTLVs() defined?
testV2WithSslTLVs() is defined in codec-haproxy/src/test/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoderTest.java at line 704.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free