Home / Function/ testResponseBrotliDecompression() — netty Function Reference

testResponseBrotliDecompression() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java lines 211–239

    @DisabledIf(value = "isNotSupported", disabledReason = "Brotli is not supported on this platform")
    @Test
    public void testResponseBrotliDecompression() throws Throwable {
        Brotli.ensureAvailability();

        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_BZ_BYTES.length + "\r\n" +
          "Content-Encoding: br\r\n" +
          "\r\n";
        ByteBuf buf = Unpooled.wrappedBuffer(headers.getBytes(CharsetUtil.US_ASCII), SAMPLE_BZ_BYTES);
        assertTrue(channel.writeInbound(buf));

        Object o = channel.readInbound();
        assertInstanceOf(FullHttpResponse.class, o);
        FullHttpResponse resp = (FullHttpResponse) o;
        assertNull(resp.headers().get(HttpHeaderNames.CONTENT_ENCODING), "Content-Encoding header should be removed");
        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 testResponseBrotliDecompression() do?
testResponseBrotliDecompression() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java.
Where is testResponseBrotliDecompression() defined?
testResponseBrotliDecompression() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java at line 211.
What does testResponseBrotliDecompression() call?
testResponseBrotliDecompression() 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