Home / Function/ testDisorder() — netty Function Reference

testDisorder() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

codec-base/src/test/java/io/netty/handler/codec/ByteToMessageDecoderTest.java lines 524–549

    @Test
    public void testDisorder() {
        ByteToMessageDecoder decoder = new ByteToMessageDecoder() {
            int count;

            //read 4 byte then remove this decoder
            @Override
            protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
                out.add(in.readByte());
                if (++count >= 4) {
                    ctx.pipeline().remove(this);
                }
            }
        };
        EmbeddedChannel channel = new EmbeddedChannel(decoder);
        assertTrue(channel.writeInbound(Unpooled.wrappedBuffer(new byte[]{1, 2, 3, 4, 5})));
        assertEquals((byte) 1, (Byte) channel.readInbound());
        assertEquals((byte) 2, (Byte) channel.readInbound());
        assertEquals((byte) 3, (Byte) channel.readInbound());
        assertEquals((byte) 4, (Byte) channel.readInbound());
        ByteBuf buffer5 = channel.readInbound();
        assertEquals((byte) 5, buffer5.readByte());
        assertFalse(buffer5.isReadable());
        assertTrue(buffer5.release());
        assertFalse(channel.finish());
    }

Domain

Subdomains

Frequently Asked Questions

What does testDisorder() do?
testDisorder() is a function in the netty codebase, defined in codec-base/src/test/java/io/netty/handler/codec/ByteToMessageDecoderTest.java.
Where is testDisorder() defined?
testDisorder() is defined in codec-base/src/test/java/io/netty/handler/codec/ByteToMessageDecoderTest.java at line 524.
What does testDisorder() call?
testDisorder() 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