Home / Function/ testFlowAutoReadOn() — netty Function Reference

testFlowAutoReadOn() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/flow/FlowControlHandlerTest.java lines 217–261

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

        ChannelInboundHandlerAdapter handler = new ChannelDuplexHandler() {

            @Override
            public void channelActive(ChannelHandlerContext ctx) throws Exception {
                peerRef.exchange(ctx.channel(), 1L, SECONDS);
                super.channelActive(ctx);
            }

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

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

            // We should receive 3 messages
            assertTrue(latch.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 testFlowAutoReadOn() do?
testFlowAutoReadOn() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/flow/FlowControlHandlerTest.java.
Where is testFlowAutoReadOn() defined?
testFlowAutoReadOn() is defined in handler/src/test/java/io/netty/handler/flow/FlowControlHandlerTest.java at line 217.

Analyze Your Own Codebase

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

Try Supermodel Free