Home / Function/ testFireChannelReadCompleteOnInactive() — netty Function Reference

testFireChannelReadCompleteOnInactive() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  9718af44_d4ad_5564_6a71_991f41945996["testFireChannelReadCompleteOnInactive()"]
  b1c999fe_35fb_8b70_a958_296cffb0616a["ByteToMessageDecoderTest"]
  9718af44_d4ad_5564_6a71_991f41945996 -->|defined in| b1c999fe_35fb_8b70_a958_296cffb0616a
  5082856a_b229_862d_0072_81f9b24f56a3["EmbeddedChannel()"]
  9718af44_d4ad_5564_6a71_991f41945996 -->|calls| 5082856a_b229_862d_0072_81f9b24f56a3
  style 9718af44_d4ad_5564_6a71_991f41945996 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-base/src/test/java/io/netty/handler/codec/ByteToMessageDecoderTest.java lines 174–215

    @Test
    public void testFireChannelReadCompleteOnInactive() throws InterruptedException {
        final BlockingQueue<Integer> queue = new LinkedBlockingDeque<Integer>();
        final ByteBuf buf = Unpooled.buffer().writeBytes(new byte[] {'a', 'b'});
        EmbeddedChannel channel = new EmbeddedChannel(new ByteToMessageDecoder() {
            @Override
            protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
                int readable = in.readableBytes();
                assertTrue(readable > 0);
                in.skipBytes(readable);
            }

            @Override
            protected void decodeLast(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
                assertFalse(in.isReadable());
                out.add("data");
            }
        }, new ChannelInboundHandlerAdapter() {
            @Override
            public void channelInactive(ChannelHandlerContext ctx) throws Exception {
                queue.add(3);
            }

            @Override
            public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
                queue.add(1);
            }

            @Override
            public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
                if (!ctx.channel().isActive()) {
                    queue.add(2);
                }
            }
        });
        assertFalse(channel.writeInbound(buf));
        channel.finish();
        assertEquals(1, (int) queue.take());
        assertEquals(2, (int) queue.take());
        assertEquals(3, (int) queue.take());
        assertTrue(queue.isEmpty());
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free