Home / Function/ testListenerNotifiedWhenIsEnd() — netty Function Reference

testListenerNotifiedWhenIsEnd() — netty Function Reference

Architecture documentation for the testListenerNotifiedWhenIsEnd() function in ChunkedWriteHandlerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  a60e6fd2_8761_b3fe_5e7d_c685ff3ed269["testListenerNotifiedWhenIsEnd()"]
  56a5cec9_e7c0_8a2d_a9b0_56df2226f2bb["ChunkedWriteHandlerTest"]
  a60e6fd2_8761_b3fe_5e7d_c685ff3ed269 -->|defined in| 56a5cec9_e7c0_8a2d_a9b0_56df2226f2bb
  9868e6d9_223c_5ab4_8019_7000479136c4["isEndOfInput()"]
  a60e6fd2_8761_b3fe_5e7d_c685ff3ed269 -->|calls| 9868e6d9_223c_5ab4_8019_7000479136c4
  08c92a94_2d5f_1e52_610b_f1d9d0eae0c2["close()"]
  a60e6fd2_8761_b3fe_5e7d_c685ff3ed269 -->|calls| 08c92a94_2d5f_1e52_610b_f1d9d0eae0c2
  95d75d44_83fa_0be3_8ad7_e4e8e6f2346e["length()"]
  a60e6fd2_8761_b3fe_5e7d_c685ff3ed269 -->|calls| 95d75d44_83fa_0be3_8ad7_e4e8e6f2346e
  93f0835d_b760_6879_8b25_3444f5508288["progress()"]
  a60e6fd2_8761_b3fe_5e7d_c685ff3ed269 -->|calls| 93f0835d_b760_6879_8b25_3444f5508288
  style a60e6fd2_8761_b3fe_5e7d_c685ff3ed269 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/stream/ChunkedWriteHandlerTest.java lines 155–215

    @Test
    public void testListenerNotifiedWhenIsEnd() {
        ByteBuf buffer = Unpooled.copiedBuffer("Test", CharsetUtil.ISO_8859_1);

        ChunkedInput<ByteBuf> input = new ChunkedInput<ByteBuf>() {
            private boolean done;
            private final ByteBuf buffer = Unpooled.copiedBuffer("Test", CharsetUtil.ISO_8859_1);

            @Override
            public boolean isEndOfInput() throws Exception {
                return done;
            }

            @Override
            public void close() throws Exception {
                buffer.release();
            }

            @Deprecated
            @Override
            public ByteBuf readChunk(ChannelHandlerContext ctx) throws Exception {
                return readChunk(ctx.alloc());
            }

            @Override
            public ByteBuf readChunk(ByteBufAllocator allocator) throws Exception {
                if (done) {
                    return null;
                }
                done = true;
                return buffer.retainedDuplicate();
            }

            @Override
            public long length() {
                return -1;
            }

            @Override
            public long progress() {
                return 1;
            }
        };

        final AtomicBoolean listenerNotified = new AtomicBoolean(false);
        final ChannelFutureListener listener = future -> listenerNotified.set(true);

        EmbeddedChannel ch = new EmbeddedChannel(new ChunkedWriteHandler());
        ch.writeAndFlush(input).addListener(listener).syncUninterruptibly();
        assertTrue(ch.finish());

        // the listener should have been notified
        assertTrue(listenerNotified.get());

        ByteBuf buffer2 = ch.readOutbound();
        assertEquals(buffer, buffer2);
        assertNull(ch.readOutbound());

        buffer.release();
        buffer2.release();
    }

Domain

Subdomains

Frequently Asked Questions

What does testListenerNotifiedWhenIsEnd() do?
testListenerNotifiedWhenIsEnd() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/stream/ChunkedWriteHandlerTest.java.
Where is testListenerNotifiedWhenIsEnd() defined?
testListenerNotifiedWhenIsEnd() is defined in handler/src/test/java/io/netty/handler/stream/ChunkedWriteHandlerTest.java at line 155.
What does testListenerNotifiedWhenIsEnd() call?
testListenerNotifiedWhenIsEnd() calls 4 function(s): close, isEndOfInput, length, progress.

Analyze Your Own Codebase

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

Try Supermodel Free