Home / Function/ testResponseChunksZstdDecompression() — netty Function Reference

testResponseChunksZstdDecompression() — netty Function Reference

Architecture documentation for the testResponseChunksZstdDecompression() function in HttpContentDecoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0a45d381_1167_b359_ed23_c5d38614b9bf["testResponseChunksZstdDecompression()"]
  ea4ec426_b689_ab52_a554_7959aed6c709["HttpContentDecoderTest"]
  0a45d381_1167_b359_ed23_c5d38614b9bf -->|defined in| ea4ec426_b689_ab52_a554_7959aed6c709
  e1fd631d_8d14_d190_2463_40108ec003a4["assertHasInboundMessages()"]
  0a45d381_1167_b359_ed23_c5d38614b9bf -->|calls| e1fd631d_8d14_d190_2463_40108ec003a4
  465668ef_fec3_d4d9_164f_24dc020645ba["assertHasOutboundMessages()"]
  0a45d381_1167_b359_ed23_c5d38614b9bf -->|calls| 465668ef_fec3_d4d9_164f_24dc020645ba
  style 0a45d381_1167_b359_ed23_c5d38614b9bf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java lines 309–345

    @Test
    public void testResponseChunksZstdDecompression() throws Throwable {
        HttpResponseDecoder decoder = new HttpResponseDecoder();
        HttpContentDecoder decompressor = new HttpContentDecompressor(0);
        HttpObjectAggregator aggregator = new HttpObjectAggregator(Integer.MAX_VALUE);
        EmbeddedChannel channel = new EmbeddedChannel(decoder, decompressor, aggregator);

        String headers = "HTTP/1.1 200 OK\r\n" +
                "Content-Length: " + SAMPLE_ZSTD_BYTES.length + "\r\n" +
                "Content-Encoding: zstd\r\n" +
                "\r\n";

        assertFalse(channel.writeInbound(Unpooled.wrappedBuffer(headers.getBytes(CharsetUtil.US_ASCII))));

        int offset = 0;
        while (offset < SAMPLE_ZSTD_BYTES.length) {
            int len = Math.min(1500, SAMPLE_ZSTD_BYTES.length - offset);
            boolean available = channel.writeInbound(Unpooled.wrappedBuffer(SAMPLE_ZSTD_BYTES, offset, len));
            offset += 1500;
            if (offset < SAMPLE_ZSTD_BYTES.length) {
                assertFalse(available);
            } else {
                assertTrue(available);
            }
        }

        Object o = channel.readInbound();
        assertInstanceOf(FullHttpResponse.class, o);
        FullHttpResponse resp = (FullHttpResponse) o;
        assertEquals(SAMPLE_STRING, resp.content().toString(CharsetUtil.UTF_8),
          "Response body should match uncompressed string");
        resp.release();

        assertHasInboundMessages(channel, false);
        assertHasOutboundMessages(channel, false);
        assertFalse(channel.finish()); // assert that no messages are left in channel
    }

Domain

Subdomains

Frequently Asked Questions

What does testResponseChunksZstdDecompression() do?
testResponseChunksZstdDecompression() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java.
Where is testResponseChunksZstdDecompression() defined?
testResponseChunksZstdDecompression() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java at line 309.
What does testResponseChunksZstdDecompression() call?
testResponseChunksZstdDecompression() calls 2 function(s): assertHasInboundMessages, assertHasOutboundMessages.

Analyze Your Own Codebase

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

Try Supermodel Free