Home / Class/ TestHandler Class — netty Architecture

TestHandler Class — netty Architecture

Architecture documentation for the TestHandler class in SocketCancelWriteTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  7d68da99_73e6_a8e8_cb9e_b22cdf136bfd["TestHandler"]
  26f938ac_c9e2_e435_62bb_812a46f54bb3["SocketCancelWriteTest.java"]
  7d68da99_73e6_a8e8_cb9e_b22cdf136bfd -->|defined in| 26f938ac_c9e2_e435_62bb_812a46f54bb3
  53a1a65b_7e67_e109_451e_6fc61d91d81d["channelActive()"]
  7d68da99_73e6_a8e8_cb9e_b22cdf136bfd -->|method| 53a1a65b_7e67_e109_451e_6fc61d91d81d
  27c284cc_a1c1_cac4_aacc_caf7a6b3251d["channelRead0()"]
  7d68da99_73e6_a8e8_cb9e_b22cdf136bfd -->|method| 27c284cc_a1c1_cac4_aacc_caf7a6b3251d
  e8a9d7d4_f37c_71e0_6bed_4be0b8f476bd["exceptionCaught()"]
  7d68da99_73e6_a8e8_cb9e_b22cdf136bfd -->|method| e8a9d7d4_f37c_71e0_6bed_4be0b8f476bd

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketCancelWriteTest.java lines 102–126

    private static class TestHandler extends SimpleChannelInboundHandler<ByteBuf> {
        volatile Channel channel;
        final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
        volatile int counter;
        final ByteBuf received = Unpooled.buffer();
        @Override
        public void channelActive(ChannelHandlerContext ctx)
                throws Exception {
            channel = ctx.channel();
        }

        @Override
        public void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
            counter += in.readableBytes();
            received.writeBytes(in);
        }

        @Override
        public void exceptionCaught(ChannelHandlerContext ctx,
                Throwable cause) throws Exception {
            if (exception.compareAndSet(null, cause)) {
                ctx.close();
            }
        }
    }

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/SocketCancelWriteTest.java.
Where is TestHandler defined?
TestHandler is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketCancelWriteTest.java at line 102.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free