Home / Function/ testFireChannelReadCompleteOnInactive() — netty Function Reference

testFireChannelReadCompleteOnInactive() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2104eb56_9670_c934_977c_ebe5f3089e8b["testFireChannelReadCompleteOnInactive()"]
  342ea63b_1bca_5900_7b37_0cc8ddc3402d["ReplayingDecoderTest"]
  2104eb56_9670_c934_977c_ebe5f3089e8b -->|defined in| 342ea63b_1bca_5900_7b37_0cc8ddc3402d
  0bda4795_4d98_a4e1_d850_763cc1379646["decode()"]
  2104eb56_9670_c934_977c_ebe5f3089e8b -->|calls| 0bda4795_4d98_a4e1_d850_763cc1379646
  b8dcd54f_e711_7fd4_b20f_3f963978ae84["channelRead()"]
  2104eb56_9670_c934_977c_ebe5f3089e8b -->|calls| b8dcd54f_e711_7fd4_b20f_3f963978ae84
  style 2104eb56_9670_c934_977c_ebe5f3089e8b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-base/src/test/java/io/netty/handler/codec/ReplayingDecoderTest.java lines 213–257

    @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 ReplayingDecoder<Integer>() {

            @Override
            protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
                int readable = in.readableBytes();
                assertTrue(readable > 0);
                in.skipBytes(readable);
                out.add("data");
            }

            @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(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/ReplayingDecoderTest.java.
Where is testFireChannelReadCompleteOnInactive() defined?
testFireChannelReadCompleteOnInactive() is defined in codec-base/src/test/java/io/netty/handler/codec/ReplayingDecoderTest.java at line 213.
What does testFireChannelReadCompleteOnInactive() call?
testFireChannelReadCompleteOnInactive() calls 2 function(s): channelRead, decode.

Analyze Your Own Codebase

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

Try Supermodel Free