Home / Class/ TestHandler Class — netty Architecture

TestHandler Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  26259b5d_34eb_6bcd_0494_c71011851f2c["TestHandler"]
  f0e980fd_4a2c_04de_3608_669447e1c777["AbstractSocketShutdownOutputByPeerTest.java"]
  26259b5d_34eb_6bcd_0494_c71011851f2c -->|defined in| f0e980fd_4a2c_04de_3608_669447e1c777
  c7adc9ca_41b9_1dfe_0ff5_37c50b1877c6["channelActive()"]
  26259b5d_34eb_6bcd_0494_c71011851f2c -->|method| c7adc9ca_41b9_1dfe_0ff5_37c50b1877c6
  280b50c8_d8ad_55a5_a045_dcaf7ee03bbc["channelInactive()"]
  26259b5d_34eb_6bcd_0494_c71011851f2c -->|method| 280b50c8_d8ad_55a5_a045_dcaf7ee03bbc
  be7c38e5_0385_da1f_4662_f920a5925852["channelRead0()"]
  26259b5d_34eb_6bcd_0494_c71011851f2c -->|method| be7c38e5_0385_da1f_4662_f920a5925852
  4b8b6fc6_baa8_7b2d_d8eb_3c2c8b7504e9["userEventTriggered()"]
  26259b5d_34eb_6bcd_0494_c71011851f2c -->|method| 4b8b6fc6_baa8_7b2d_d8eb_3c2c8b7504e9

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/AbstractSocketShutdownOutputByPeerTest.java lines 150–179

    private static class TestHandler extends SimpleChannelInboundHandler<ByteBuf> {
        volatile DuplexChannel ch;
        final BlockingQueue<Byte> queue = new LinkedBlockingQueue<Byte>();
        final CountDownLatch halfClosure = new CountDownLatch(1);
        final CountDownLatch closure = new CountDownLatch(1);
        final AtomicInteger halfClosureCount = new AtomicInteger();

        @Override
        public void channelActive(ChannelHandlerContext ctx) throws Exception {
            ch = (DuplexChannel) ctx.channel();
        }

        @Override
        public void channelInactive(ChannelHandlerContext ctx) throws Exception {
            closure.countDown();
        }

        @Override
        public void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
            queue.offer(msg.readByte());
        }

        @Override
        public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
            if (evt instanceof ChannelInputShutdownEvent) {
                halfClosureCount.incrementAndGet();
                halfClosure.countDown();
            }
        }
    }

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

Analyze Your Own Codebase

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

Try Supermodel Free