Home / Function/ testDecodeLast() — netty Function Reference

testDecodeLast() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  02dc5169_12b5_1b09_ecdd_e7733c4ec2c4["testDecodeLast()"]
  b1c999fe_35fb_8b70_a958_296cffb0616a["ByteToMessageDecoderTest"]
  02dc5169_12b5_1b09_ecdd_e7733c4ec2c4 -->|defined in| b1c999fe_35fb_8b70_a958_296cffb0616a
  5082856a_b229_862d_0072_81f9b24f56a3["EmbeddedChannel()"]
  02dc5169_12b5_1b09_ecdd_e7733c4ec2c4 -->|calls| 5082856a_b229_862d_0072_81f9b24f56a3
  055e5723_0f5b_8b83_9de3_bedcb348a8e8["assertBuffer()"]
  02dc5169_12b5_1b09_ecdd_e7733c4ec2c4 -->|calls| 055e5723_0f5b_8b83_9de3_bedcb348a8e8
  style 02dc5169_12b5_1b09_ecdd_e7733c4ec2c4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-base/src/test/java/io/netty/handler/codec/ByteToMessageDecoderTest.java lines 551–575

    @Test
    public void testDecodeLast() {
        final AtomicBoolean removeHandler = new AtomicBoolean();
        EmbeddedChannel channel = new EmbeddedChannel(new ByteToMessageDecoder() {

            @Override
            protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
                if (removeHandler.get()) {
                    ctx.pipeline().remove(this);
                }
            }
        });
        byte[] bytes = new byte[1024];
        ThreadLocalRandom.current().nextBytes(bytes);

        assertFalse(channel.writeInbound(Unpooled.copiedBuffer(bytes)));
        assertNull(channel.readInbound());
        removeHandler.set(true);
        // This should trigger channelInputClosed(...)
        channel.pipeline().fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE);

        assertTrue(channel.finish());
        assertBuffer(Unpooled.wrappedBuffer(bytes), (ByteBuf) channel.readInbound());
        assertNull(channel.readInbound());
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free