testUnixEncodeProxyV2() — netty Function Reference
Architecture documentation for the testUnixEncodeProxyV2() function in HaProxyMessageEncoderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 41c4d3cb_79a0_34c3_0619_12844744d663["testUnixEncodeProxyV2()"] 4545ac9d_2f62_4ac7_c80f_5975d8175456["HaProxyMessageEncoderTest"] 41c4d3cb_79a0_34c3_0619_12844744d663 -->|defined in| 4545ac9d_2f62_4ac7_c80f_5975d8175456 style 41c4d3cb_79a0_34c3_0619_12844744d663 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-haproxy/src/test/java/io/netty/handler/codec/haproxy/HaProxyMessageEncoderTest.java lines 188–229
@Test
public void testUnixEncodeProxyV2() {
EmbeddedChannel ch = new EmbeddedChannel(INSTANCE);
HAProxyMessage message = new HAProxyMessage(
HAProxyProtocolVersion.V2, HAProxyCommand.PROXY, HAProxyProxiedProtocol.UNIX_STREAM,
"/var/run/src.sock", "/var/run/dst.sock", 0, 0);
assertTrue(ch.writeOutbound(message));
ByteBuf byteBuf = ch.readOutbound();
// header
byte[] headerBytes = ByteBufUtil.getBytes(byteBuf, 0, 12);
assertArrayEquals(BINARY_PREFIX, headerBytes);
// command
byte commandByte = byteBuf.getByte(12);
assertEquals(0x02, (commandByte & 0xf0) >> 4);
assertEquals(0x01, commandByte & 0x0f);
// transport protocol, address family
byte transportByte = byteBuf.getByte(13);
assertEquals(0x03, (transportByte & 0xf0) >> 4);
assertEquals(0x01, transportByte & 0x0f);
// address length
int addrLength = byteBuf.getUnsignedShort(14);
assertEquals(TOTAL_UNIX_ADDRESS_BYTES_LENGTH, addrLength);
// source address
int srcAddrEnd = byteBuf.forEachByte(16, 108, ByteProcessor.FIND_NUL);
assertEquals("/var/run/src.sock",
byteBuf.slice(16, srcAddrEnd - 16).toString(CharsetUtil.US_ASCII));
// destination address
int dstAddrEnd = byteBuf.forEachByte(124, 108, ByteProcessor.FIND_NUL);
assertEquals("/var/run/dst.sock",
byteBuf.slice(124, dstAddrEnd - 124).toString(CharsetUtil.US_ASCII));
byteBuf.release();
assertFalse(ch.finish());
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does testUnixEncodeProxyV2() do?
testUnixEncodeProxyV2() is a function in the netty codebase, defined in codec-haproxy/src/test/java/io/netty/handler/codec/haproxy/HaProxyMessageEncoderTest.java.
Where is testUnixEncodeProxyV2() defined?
testUnixEncodeProxyV2() is defined in codec-haproxy/src/test/java/io/netty/handler/codec/haproxy/HaProxyMessageEncoderTest.java at line 188.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free