Home / Function/ flowControlProperlyChunksLargeMessage() — netty Function Reference

flowControlProperlyChunksLargeMessage() — netty Function Reference

Architecture documentation for the flowControlProperlyChunksLargeMessage() function in Http2ConnectionRoundtripTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  381263d7_4dc0_4425_3529_0ea206dd5b7c["flowControlProperlyChunksLargeMessage()"]
  0d6189e8_c033_39ff_d087_9019351440fe["Http2ConnectionRoundtripTest"]
  381263d7_4dc0_4425_3529_0ea206dd5b7c -->|defined in| 0d6189e8_c033_39ff_d087_9019351440fe
  1dd685b8_9b56_5b35_70ca_7f2bf9016254["bootstrapEnv()"]
  381263d7_4dc0_4425_3529_0ea206dd5b7c -->|calls| 1dd685b8_9b56_5b35_70ca_7f2bf9016254
  f8a98f5a_5b4f_5e46_24a0_b03b1f68c64a["setClientGracefulShutdownTime()"]
  381263d7_4dc0_4425_3529_0ea206dd5b7c -->|calls| f8a98f5a_5b4f_5e46_24a0_b03b1f68c64a
  style 381263d7_4dc0_4425_3529_0ea206dd5b7c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java lines 993–1055

    @Test
    public void flowControlProperlyChunksLargeMessage() throws Exception {
        final Http2Headers headers = dummyHeaders();
        final Http2Headers trailers = dummyTrailers();

        // Create a large message to send.
        final int length = 10485760; // 10MB

        // Create a buffer filled with random bytes.
        final ByteBuf data = randomBytes(length);
        final ByteArrayOutputStream out = new ByteArrayOutputStream(length);
        doAnswer(new Answer<Integer>() {
            @Override
            public Integer answer(InvocationOnMock in) throws Throwable {
                ByteBuf buf = (ByteBuf) in.getArguments()[2];
                int padding = (Integer) in.getArguments()[3];
                int processedBytes = buf.readableBytes() + padding;

                buf.readBytes(out, buf.readableBytes());
                return processedBytes;
            }
        }).when(serverListener).onDataRead(any(ChannelHandlerContext.class), eq(3),
                any(ByteBuf.class), eq(0), anyBoolean());
        try {
            // Initialize the data latch based on the number of bytes expected.
            bootstrapEnv(length, 1, 3, 1);

            // Create the stream and send all of the data at once.
            runInChannel(clientChannel, new Http2Runnable() {
                @Override
                public void run() throws Http2Exception {
                    http2Client.encoder().writeHeaders(ctx(), 3, headers, 0, (short) 16, false, 0,
                            false, newPromise());
                    http2Client.encoder().writeData(ctx(), 3, data.retainedDuplicate(), 0, false, newPromise());

                    // Write trailers.
                    http2Client.encoder().writeHeaders(ctx(), 3, trailers, 0, (short) 16, false, 0,
                            true, newPromise());
                    http2Client.flush(ctx());
                }
            });

            // Wait for the trailers to be received.
            assertTrue(serverSettingsAckLatch.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));
            assertTrue(trailersLatch.await(DEFAULT_AWAIT_TIMEOUT_SECONDS, SECONDS));

            // Verify that headers and trailers were received.
            verify(serverListener).onHeadersRead(any(ChannelHandlerContext.class), eq(3), eq(headers), eq(0),
                    eq((short) 16), eq(false), eq(0), eq(false));
            verify(serverListener).onHeadersRead(any(ChannelHandlerContext.class), eq(3), eq(trailers), eq(0),
                    eq((short) 16), eq(false), eq(0), eq(true));

            // Verify we received all the bytes.
            assertEquals(0, dataLatch.getCount());
            out.flush();
            byte[] received = out.toByteArray();
            assertArrayEquals(data.array(), received);
        } finally {
            // Don't wait for server to close streams
            setClientGracefulShutdownTime(0);
            data.release();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does flowControlProperlyChunksLargeMessage() do?
flowControlProperlyChunksLargeMessage() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java.
Where is flowControlProperlyChunksLargeMessage() defined?
flowControlProperlyChunksLargeMessage() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java at line 993.
What does flowControlProperlyChunksLargeMessage() call?
flowControlProperlyChunksLargeMessage() calls 2 function(s): bootstrapEnv, setClientGracefulShutdownTime.

Analyze Your Own Codebase

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

Try Supermodel Free