Home / Function/ testInvokeReadWhenNotProduceMessage() — netty Function Reference

testInvokeReadWhenNotProduceMessage() — netty Function Reference

Architecture documentation for the testInvokeReadWhenNotProduceMessage() function in HttpContentDecompressorTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  bf87b63e_4adc_26e5_12ee_55244a091126["testInvokeReadWhenNotProduceMessage()"]
  ad239479_d432_6bb8_104c_16b5ed7eb774["HttpContentDecompressorTest"]
  bf87b63e_4adc_26e5_12ee_55244a091126 -->|defined in| ad239479_d432_6bb8_104c_16b5ed7eb774
  b0d7a82f_c66f_3e0f_8055_3d339eec58a3["channelRead()"]
  bf87b63e_4adc_26e5_12ee_55244a091126 -->|calls| b0d7a82f_c66f_3e0f_8055_3d339eec58a3
  style bf87b63e_4adc_26e5_12ee_55244a091126 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecompressorTest.java lines 44–82

    @Test
    public void testInvokeReadWhenNotProduceMessage() {
        final AtomicInteger readCalled = new AtomicInteger();
        EmbeddedChannel channel = new EmbeddedChannel(new ChannelOutboundHandlerAdapter() {
            @Override
            public void read(ChannelHandlerContext ctx) {
                readCalled.incrementAndGet();
                ctx.read();
            }
        }, new HttpContentDecompressor(0), new ChannelInboundHandlerAdapter() {
            @Override
            public void channelRead(ChannelHandlerContext ctx, Object msg) {
                ctx.fireChannelRead(msg);
                ctx.read();
            }
        });

        channel.config().setAutoRead(false);

        readCalled.set(0);
        HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
        response.headers().set(HttpHeaderNames.CONTENT_ENCODING, "gzip");
        response.headers().set(HttpHeaderNames.CONTENT_TYPE, "application/json;charset=UTF-8");
        response.headers().set(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED);

        assertTrue(channel.writeInbound(response));

        // we triggered read explicitly
        assertEquals(1, readCalled.get());

        assertTrue(channel.readInbound() instanceof HttpResponse);

        assertFalse(channel.writeInbound(new DefaultHttpContent(Unpooled.EMPTY_BUFFER)));

        // read was triggered by the HttpContentDecompressor itself as it did not produce any message to the next
        // inbound handler.
        assertEquals(2, readCalled.get());
        assertFalse(channel.finishAndReleaseAll());
    }

Domain

Subdomains

Frequently Asked Questions

What does testInvokeReadWhenNotProduceMessage() do?
testInvokeReadWhenNotProduceMessage() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecompressorTest.java.
Where is testInvokeReadWhenNotProduceMessage() defined?
testInvokeReadWhenNotProduceMessage() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecompressorTest.java at line 44.
What does testInvokeReadWhenNotProduceMessage() call?
testInvokeReadWhenNotProduceMessage() calls 1 function(s): channelRead.

Analyze Your Own Codebase

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

Try Supermodel Free