Home / Function/ testFlushInWritabilityChanged() — netty Function Reference

testFlushInWritabilityChanged() — netty Function Reference

Architecture documentation for the testFlushInWritabilityChanged() function in ReentrantChannelTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ef11a39e_d0ab_0511_0453_427051cac84f["testFlushInWritabilityChanged()"]
  13a11eea_27b7_44b5_a4d5_69eb21dd0e09["ReentrantChannelTest"]
  ef11a39e_d0ab_0511_0453_427051cac84f -->|defined in| 13a11eea_27b7_44b5_a4d5_69eb21dd0e09
  style ef11a39e_d0ab_0511_0453_427051cac84f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/ReentrantChannelTest.java lines 115–163

    @Test
    public void testFlushInWritabilityChanged() throws Exception {

        LocalAddress addr = new LocalAddress("testFlushInWritabilityChanged");

        ServerBootstrap sb = getLocalServerBootstrap();
        sb.bind(addr).sync().channel();

        Bootstrap cb = getLocalClientBootstrap();

        setInterest(Event.WRITE, Event.FLUSH, Event.WRITABILITY);

        Channel clientChannel = cb.connect(addr).sync().channel();
        clientChannel.config().setWriteBufferLowWaterMark(512);
        clientChannel.config().setWriteBufferHighWaterMark(1024);

        clientChannel.pipeline().addLast(new ChannelInboundHandlerAdapter() {
            @Override
            public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
                if (!ctx.channel().isWritable()) {
                    ctx.channel().flush();
                }
                ctx.fireChannelWritabilityChanged();
            }
        });

        assertTrue(clientChannel.isWritable());

        clientChannel.write(createTestBuf(2000)).sync();
        clientChannel.close().sync();

        assertLog(
                // Case 1:
                "WRITABILITY: writable=false\n" +
                "FLUSH\n" +
                "WRITE\n" +
                "WRITABILITY: writable=false\n" +
                "WRITABILITY: writable=false\n" +
                "FLUSH\n" +
                "WRITABILITY: writable=true\n",
                // Case 2:
                "WRITABILITY: writable=false\n" +
                "FLUSH\n" +
                "WRITE\n" +
                "WRITABILITY: writable=false\n" +
                "FLUSH\n" +
                "WRITABILITY: writable=true\n" +
                "WRITABILITY: writable=true\n");
    }

Domain

Subdomains

Frequently Asked Questions

What does testFlushInWritabilityChanged() do?
testFlushInWritabilityChanged() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/ReentrantChannelTest.java.
Where is testFlushInWritabilityChanged() defined?
testFlushInWritabilityChanged() is defined in transport/src/test/java/io/netty/channel/ReentrantChannelTest.java at line 115.

Analyze Your Own Codebase

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

Try Supermodel Free