TestHandler Class — netty Architecture
Architecture documentation for the TestHandler class in SocketGatheringWriteTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 724cc093_a524_f1ca_f2d5_4854ba1ad9e7["TestHandler"] 41c5cef7_c62b_3a8b_889d_709938bf272c["SocketGatheringWriteTest.java"] 724cc093_a524_f1ca_f2d5_4854ba1ad9e7 -->|defined in| 41c5cef7_c62b_3a8b_889d_709938bf272c d0f1a31e_121b_cb14_4b30_5731efd063b6["TestHandler()"] 724cc093_a524_f1ca_f2d5_4854ba1ad9e7 -->|method| d0f1a31e_121b_cb14_4b30_5731efd063b6 c405fdfc_6be7_aaf2_ea58_ce735c9ac7dd["channelActive()"] 724cc093_a524_f1ca_f2d5_4854ba1ad9e7 -->|method| c405fdfc_6be7_aaf2_ea58_ce735c9ac7dd 78b2eee0_ca67_ed3f_96d4_d9e889779552["channelRead0()"] 724cc093_a524_f1ca_f2d5_4854ba1ad9e7 -->|method| 78b2eee0_ca67_ed3f_96d4_d9e889779552 36ff1fd3_5d9b_c663_1f4a_21a76951f7db["channelReadComplete()"] 724cc093_a524_f1ca_f2d5_4854ba1ad9e7 -->|method| 36ff1fd3_5d9b_c663_1f4a_21a76951f7db 6b4970d7_6c3c_efe6_808d_b1c6ee3ce1ba["exceptionCaught()"] 724cc093_a524_f1ca_f2d5_4854ba1ad9e7 -->|method| 6b4970d7_6c3c_efe6_808d_b1c6ee3ce1ba 215f38e1_7a11_f23d_b6a4_7846a83c5651["handleException()"] 724cc093_a524_f1ca_f2d5_4854ba1ad9e7 -->|method| 215f38e1_7a11_f23d_b6a4_7846a83c5651
Relationship Graph
Source Code
testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketGatheringWriteTest.java lines 239–280
private static class TestHandler extends SimpleChannelInboundHandler<ByteBuf> {
private final boolean autoRead;
volatile Channel channel;
final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
TestHandler(boolean autoRead) {
this.autoRead = autoRead;
}
@Override
public final void channelActive(ChannelHandlerContext ctx) throws Exception {
channel = ctx.channel();
if (!autoRead) {
ctx.read();
}
super.channelActive(ctx);
}
@Override
public void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
}
@Override
public final void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
if (!autoRead) {
ctx.read();
}
super.channelReadComplete(ctx);
}
@Override
public final void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (exception.compareAndSet(null, cause)) {
handleException(ctx, cause);
}
super.exceptionCaught(ctx, cause);
}
void handleException(ChannelHandlerContext ctx, Throwable cause) {
ctx.close();
}
}
Defined In
Source
Frequently Asked Questions
What is the TestHandler class?
TestHandler is a class in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketGatheringWriteTest.java.
Where is TestHandler defined?
TestHandler is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketGatheringWriteTest.java at line 239.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free