Home / Function/ testGarbageChunk() — netty Function Reference

testGarbageChunk() — netty Function Reference

Architecture documentation for the testGarbageChunk() function in HttpResponseDecoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  dc3f70fa_fdf2_b22b_a106_acd2cad84091["testGarbageChunk()"]
  90546a8c_51c4_a9dc_b6e8_695d29269596["HttpResponseDecoderTest"]
  dc3f70fa_fdf2_b22b_a106_acd2cad84091 -->|defined in| 90546a8c_51c4_a9dc_b6e8_695d29269596
  style dc3f70fa_fdf2_b22b_a106_acd2cad84091 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java lines 862–883

    @Test
    public void testGarbageChunk() {
        EmbeddedChannel channel = new EmbeddedChannel(new HttpResponseDecoder());
        String responseWithIllegalChunk =
                "HTTP/1.1 200 OK\r\n" +
                "Transfer-Encoding: chunked\r\n\r\n" +
                "NOT_A_CHUNK_LENGTH\r\n";

        channel.writeInbound(Unpooled.copiedBuffer(responseWithIllegalChunk, CharsetUtil.US_ASCII));
        assertInstanceOf(HttpResponse.class, channel.readInbound());

        // Ensure that the decoder generates the last chunk with correct decoder result.
        LastHttpContent invalidChunk = channel.readInbound();
        assertTrue(invalidChunk.decoderResult().isFailure());
        invalidChunk.release();

        // And no more messages should be produced by the decoder.
        assertNull(channel.readInbound());

        // .. even after the connection is closed.
        assertFalse(channel.finish());
    }

Domain

Subdomains

Frequently Asked Questions

What does testGarbageChunk() do?
testGarbageChunk() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java.
Where is testGarbageChunk() defined?
testGarbageChunk() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java at line 862.

Analyze Your Own Codebase

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

Try Supermodel Free