Home / Function/ testDoesNotOverReadOnChannelReadComplete() — netty Function Reference

testDoesNotOverReadOnChannelReadComplete() — netty Function Reference

Architecture documentation for the testDoesNotOverReadOnChannelReadComplete() function in ByteToMessageDecoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  13efa6ae_e9c7_7843_b318_00dc39d4fce6["testDoesNotOverReadOnChannelReadComplete()"]
  b1c999fe_35fb_8b70_a958_296cffb0616a["ByteToMessageDecoderTest"]
  13efa6ae_e9c7_7843_b318_00dc39d4fce6 -->|defined in| b1c999fe_35fb_8b70_a958_296cffb0616a
  5082856a_b229_862d_0072_81f9b24f56a3["EmbeddedChannel()"]
  13efa6ae_e9c7_7843_b318_00dc39d4fce6 -->|calls| 5082856a_b229_862d_0072_81f9b24f56a3
  aa1df8f4_7da8_b487_8429_185255a151e0["read()"]
  13efa6ae_e9c7_7843_b318_00dc39d4fce6 -->|calls| aa1df8f4_7da8_b487_8429_185255a151e0
  style 13efa6ae_e9c7_7843_b318_00dc39d4fce6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-base/src/test/java/io/netty/handler/codec/ByteToMessageDecoderTest.java lines 493–522

    @Test
    public void testDoesNotOverReadOnChannelReadComplete() {
        ReadInterceptingHandler interceptor = new ReadInterceptingHandler();
        EmbeddedChannel channel = new EmbeddedChannel(interceptor, new ByteToMessageDecoder() {
            @Override
            protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
                // NOOP
            }
        });
        channel.config().setAutoRead(false);
        assertEquals(1, interceptor.readsTriggered);
        channel.pipeline().fireChannelReadComplete();
        assertEquals(1, interceptor.readsTriggered);
        channel.pipeline().fireChannelRead(Unpooled.buffer().writeZero(8));
        assertEquals(1, interceptor.readsTriggered);
        // This should trigger a read() as we did not forward any message.
        channel.pipeline().fireChannelReadComplete();
        assertEquals(2, interceptor.readsTriggered);
        // Explicit calling fireChannelReadComplete() again without calling fireChannelRead(...) before should
        // not trigger another read()
        channel.pipeline().fireChannelReadComplete();
        assertEquals(2, interceptor.readsTriggered);
        channel.pipeline().fireChannelRead(Unpooled.buffer().writeZero(8));
        assertEquals(2, interceptor.readsTriggered);

        // This should trigger a read() as we did not forward any message.
        channel.pipeline().fireChannelReadComplete();
        assertEquals(3, interceptor.readsTriggered);
        channel.finishAndReleaseAll();
    }

Domain

Subdomains

Frequently Asked Questions

What does testDoesNotOverReadOnChannelReadComplete() do?
testDoesNotOverReadOnChannelReadComplete() is a function in the netty codebase, defined in codec-base/src/test/java/io/netty/handler/codec/ByteToMessageDecoderTest.java.
Where is testDoesNotOverReadOnChannelReadComplete() defined?
testDoesNotOverReadOnChannelReadComplete() is defined in codec-base/src/test/java/io/netty/handler/codec/ByteToMessageDecoderTest.java at line 493.
What does testDoesNotOverReadOnChannelReadComplete() call?
testDoesNotOverReadOnChannelReadComplete() calls 2 function(s): EmbeddedChannel, read.

Analyze Your Own Codebase

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

Try Supermodel Free