tcpExceptionCaught() — netty Function Reference
Architecture documentation for the tcpExceptionCaught() function in PcapWriteHandlerTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 39c4e83d_8291_f4fc_67f9_2ac9c9d08e03["tcpExceptionCaught()"] e9f4993c_4935_9405_4fab_0bbc9030a673["PcapWriteHandlerTest"] 39c4e83d_8291_f4fc_67f9_2ac9c9d08e03 -->|defined in| e9f4993c_4935_9405_4fab_0bbc9030a673 201e7e9e_c23c_b328_ecb1_117026fc1c03["InetSocketAddress()"] 39c4e83d_8291_f4fc_67f9_2ac9c9d08e03 -->|calls| 201e7e9e_c23c_b328_ecb1_117026fc1c03 a21dcafa_3fd5_25fa_9ab3_64ba75a8e86a["verifyTcpHandshakeCapture()"] 39c4e83d_8291_f4fc_67f9_2ac9c9d08e03 -->|calls| a21dcafa_3fd5_25fa_9ab3_64ba75a8e86a style 39c4e83d_8291_f4fc_67f9_2ac9c9d08e03 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java lines 827–880
@Test
public void tcpExceptionCaught() {
final ByteBuf pcapBuffer = Unpooled.buffer();
final RuntimeException exception = new RuntimeException();
InetSocketAddress serverAddr = new InetSocketAddress("1.1.1.1", 1234);
InetSocketAddress clientAddr = new InetSocketAddress("2.2.2.2", 3456);
CloseDetectingByteBufOutputStream outputStream = new CloseDetectingByteBufOutputStream(pcapBuffer);
final EmbeddedChannel embeddedChannel = new EmbeddedChannel(
new ChannelInboundHandlerAdapter() {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
super.channelActive(ctx);
ctx.fireExceptionCaught(exception);
}
},
PcapWriteHandler.builder()
.forceTcpChannel(serverAddr, clientAddr, false)
.build(outputStream)
);
// Verify tcp handshake, tcp rst, and stream close
assertTrue(outputStream.closeCalled());
verifyTcpHandshakeCapture(true, pcapBuffer, serverAddr, clientAddr);
// Verify rst
ByteBuf tcpPacket = verifyTcpBaseHeaders(pcapBuffer, serverAddr, 0);
assertEquals(clientAddr.getPort() & 0xffff, tcpPacket.readUnsignedShort()); // Source Port
assertEquals(serverAddr.getPort() & 0xffff, tcpPacket.readUnsignedShort()); // Destination Port
assertEquals(1, tcpPacket.readUnsignedInt()); // Sequence number
assertEquals(1, tcpPacket.readUnsignedInt()); // Ack number
tcpPacket.readByte(); // Offset/Reserved
assertEquals(20, tcpPacket.readByte()); // RST control bit
assertEquals(65535, tcpPacket.readUnsignedShort()); // Window Size
assertEquals(1, tcpPacket.readUnsignedShort()); // Checksum
assertEquals(0, tcpPacket.readUnsignedShort()); // Urgent Pointer
// Verify thrown exception
try {
embeddedChannel.checkException();
fail();
} catch (Throwable t) {
assertSame(exception, t);
} finally {
pcapBuffer.release();
}
assertFalse(embeddedChannel.finishAndReleaseAll());
}
Domain
Subdomains
Source
Frequently Asked Questions
What does tcpExceptionCaught() do?
tcpExceptionCaught() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java.
Where is tcpExceptionCaught() defined?
tcpExceptionCaught() is defined in handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java at line 827.
What does tcpExceptionCaught() call?
tcpExceptionCaught() calls 2 function(s): InetSocketAddress, verifyTcpHandshakeCapture.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free