Home / Function/ testFlowAutoReadOff() — netty Function Reference

testFlowAutoReadOff() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/flow/FlowControlHandlerTest.java lines 355–410

    @Test
    public void testFlowAutoReadOff() throws Exception {
        final Exchanger<Channel> peerRef = new Exchanger<Channel>();
        final CountDownLatch msgRcvLatch1 = new CountDownLatch(1);
        final CountDownLatch msgRcvLatch2 = new CountDownLatch(2);
        final CountDownLatch msgRcvLatch3 = new CountDownLatch(3);

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

            @Override
            public void channelRead(ChannelHandlerContext ctx, Object msg) {
                msgRcvLatch1.countDown();
                msgRcvLatch2.countDown();
                msgRcvLatch3.countDown();
            }
        };

        final FlowControlHandler flow = new FlowControlHandler();
        Channel server = newServer(false, flow, 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();

            // channelRead(1)
            peer.read();
            assertTrue(msgRcvLatch1.await(1L, SECONDS));

            // channelRead(2)
            peer.read();
            assertTrue(msgRcvLatch2.await(1L, SECONDS));

            // channelRead(3)
            peer.read();
            assertTrue(msgRcvLatch3.await(1L, SECONDS));

            assertTrue(peer.eventLoop().submit(new Callable<Boolean>() {
                @Override
                public Boolean call() {
                    return flow.isQueueEmpty();
                }
            }).get());
        } finally {
            client.close();
            server.close();
        }
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free