Home / Function/ testAutoReadingOff() — netty Function Reference

testAutoReadingOff() — netty Function Reference

Architecture documentation for the testAutoReadingOff() function in FlowControlHandlerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f3ded4f1_1ea7_98f6_e0ca_a2b2889b30f0["testAutoReadingOff()"]
  403e241f_d76e_484e_d952_7f7a46681916["FlowControlHandlerTest"]
  f3ded4f1_1ea7_98f6_e0ca_a2b2889b30f0 -->|defined in| 403e241f_d76e_484e_d952_7f7a46681916
  style f3ded4f1_1ea7_98f6_e0ca_a2b2889b30f0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/flow/FlowControlHandlerTest.java lines 170–211

    @Test
    public void testAutoReadingOff() throws Exception {
        final Exchanger<Channel> peerRef = new Exchanger<Channel>();
        final CountDownLatch latch = new CountDownLatch(3);

        ChannelInboundHandlerAdapter handler = new ChannelInboundHandlerAdapter() {
            @Override
            public void channelActive(ChannelHandlerContext ctx) throws Exception {
                peerRef.exchange(ctx.channel(), 1L, SECONDS);
                ctx.fireChannelActive();
            }

            @Override
            public void channelRead(ChannelHandlerContext ctx, Object msg) {
                ReferenceCountUtil.release(msg);
                latch.countDown();
            }
        };

        Channel server = newServer(false, handler);
        Channel client = newClient(server.localAddress());

        try {
            // The client connection on the server side
            Channel peer = peerRef.exchange(null, 1L, SECONDS);

            // Write the message
            client.writeAndFlush(newOneMessage())
                .syncUninterruptibly();

            // Read the message
            peer.read();

            // We received all three messages but hoped that only one
            // message was read because auto reading was off and we
            // invoked the read() method only once.
            assertTrue(latch.await(1L, SECONDS));
        } finally {
            client.close();
            server.close();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testAutoReadingOff() do?
testAutoReadingOff() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/flow/FlowControlHandlerTest.java.
Where is testAutoReadingOff() defined?
testAutoReadingOff() is defined in handler/src/test/java/io/netty/handler/flow/FlowControlHandlerTest.java at line 170.

Analyze Your Own Codebase

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

Try Supermodel Free