Home / Function/ testForwardPendingData() — netty Function Reference

testForwardPendingData() — netty Function Reference

Architecture documentation for the testForwardPendingData() function in ByteToMessageCodecTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  d72df527_8e9d_88aa_bcc9_1dbc13f21533["testForwardPendingData()"]
  50026bb4_a91a_3459_adea_65a461d42761["ByteToMessageCodecTest"]
  d72df527_8e9d_88aa_bcc9_1dbc13f21533 -->|defined in| 50026bb4_a91a_3459_adea_65a461d42761
  4d08a927_a2b1_1bb0_c4ef_0433b7206323["encode()"]
  d72df527_8e9d_88aa_bcc9_1dbc13f21533 -->|calls| 4d08a927_a2b1_1bb0_c4ef_0433b7206323
  ba6b4f08_9a71_1358_8abd_0320e540495e["decode()"]
  d72df527_8e9d_88aa_bcc9_1dbc13f21533 -->|calls| ba6b4f08_9a71_1358_8abd_0320e540495e
  style d72df527_8e9d_88aa_bcc9_1dbc13f21533 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-base/src/test/java/io/netty/handler/codec/ByteToMessageCodecTest.java lines 55–86

    @Test
    public void testForwardPendingData() {
        ByteToMessageCodec<Integer> codec = new ByteToMessageCodec<Integer>() {
            @Override
            protected void encode(ChannelHandlerContext ctx, Integer msg, ByteBuf out) {
                out.writeInt(msg);
            }

            @Override
            protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
                if (in.readableBytes() >= 4) {
                    out.add(in.readInt());
                }
            }
        };

        ByteBuf buffer = Unpooled.buffer();
        buffer.writeInt(1);
        buffer.writeByte('0');

        EmbeddedChannel ch = new EmbeddedChannel(codec);
        assertTrue(ch.writeInbound(buffer));
        ch.pipeline().remove(codec);
        assertTrue(ch.finish());
        assertEquals(1, (Integer) ch.readInbound());

        ByteBuf buf = ch.readInbound();
        assertEquals(Unpooled.wrappedBuffer(new byte[]{'0'}), buf);
        buf.release();
        assertNull(ch.readInbound());
        assertNull(ch.readOutbound());
    }

Domain

Subdomains

Frequently Asked Questions

What does testForwardPendingData() do?
testForwardPendingData() is a function in the netty codebase, defined in codec-base/src/test/java/io/netty/handler/codec/ByteToMessageCodecTest.java.
Where is testForwardPendingData() defined?
testForwardPendingData() is defined in codec-base/src/test/java/io/netty/handler/codec/ByteToMessageCodecTest.java at line 55.
What does testForwardPendingData() call?
testForwardPendingData() calls 2 function(s): decode, encode.

Analyze Your Own Codebase

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

Try Supermodel Free