Home / Class/ TestHandler Class — netty Architecture

TestHandler Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  88436a83_215b_6fbc_c16d_250152e760da["TestHandler"]
  e837723b_5371_6b18_b1d0_48504d911ae7["DetectPeerCloseWithoutReadTest.java"]
  88436a83_215b_6fbc_c16d_250152e760da -->|defined in| e837723b_5371_6b18_b1d0_48504d911ae7
  7170367b_e17b_7820_cc1b_96844cf96015["TestHandler()"]
  88436a83_215b_6fbc_c16d_250152e760da -->|method| 7170367b_e17b_7820_cc1b_96844cf96015
  fb74de3e_0124_a9ab_fd32_777f5566e47d["channelRead0()"]
  88436a83_215b_6fbc_c16d_250152e760da -->|method| fb74de3e_0124_a9ab_fd32_777f5566e47d
  d77da86e_f66a_0edb_ec9a_f71709d4498d["channelInactive()"]
  88436a83_215b_6fbc_c16d_250152e760da -->|method| d77da86e_f66a_0edb_ec9a_f71709d4498d

Relationship Graph

Source Code

transport-native-unix-common-tests/src/main/java/io/netty/channel/unix/tests/DetectPeerCloseWithoutReadTest.java lines 187–213

    private static final class TestHandler extends SimpleChannelInboundHandler<ByteBuf> {
        private final AtomicInteger bytesRead;
        private final boolean extraReadRequested;
        private final CountDownLatch latch;

        TestHandler(AtomicInteger bytesRead, boolean extraReadRequested, CountDownLatch latch) {
            this.bytesRead = bytesRead;
            this.extraReadRequested = extraReadRequested;
            this.latch = latch;
        }

        @Override
        protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) {
            bytesRead.addAndGet(msg.readableBytes());

            if (extraReadRequested) {
                // Because autoread is off, we call read to consume all data until we detect the close.
                ctx.read();
            }
        }

        @Override
        public void channelInactive(ChannelHandlerContext ctx) {
            latch.countDown();
            ctx.fireChannelInactive();
        }
    }

Frequently Asked Questions

What is the TestHandler class?
TestHandler is a class in the netty codebase, defined in transport-native-unix-common-tests/src/main/java/io/netty/channel/unix/tests/DetectPeerCloseWithoutReadTest.java.
Where is TestHandler defined?
TestHandler is defined in transport-native-unix-common-tests/src/main/java/io/netty/channel/unix/tests/DetectPeerCloseWithoutReadTest.java at line 187.

Analyze Your Own Codebase

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

Try Supermodel Free