Home / Class/ DataCompressionHttp2Test Class — netty Architecture

DataCompressionHttp2Test Class — netty Architecture

Architecture documentation for the DataCompressionHttp2Test class in DataCompressionHttp2Test.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9e639957_0a4c_c19f_71db_e7a3e405c155["DataCompressionHttp2Test"]
  6c034024_bcf0_7636_26b7_c264c756e9dc["DataCompressionHttp2Test.java"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|defined in| 6c034024_bcf0_7636_26b7_c264c756e9dc
  6cecb388_8d19_561f_e50c_8b308f8d0034["beforeAllTests()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| 6cecb388_8d19_561f_e50c_8b308f8d0034
  a22e435e_0d1a_e8b4_2f44_748a27f55afe["setup()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| a22e435e_0d1a_e8b4_2f44_748a27f55afe
  e4269bb1_1a11_8f18_20fd_dc64914bebb9["cleanup()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| e4269bb1_1a11_8f18_20fd_dc64914bebb9
  40c8a879_c0f9_a7c6_87bd_6dd7f2c0d812["teardown()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| 40c8a879_c0f9_a7c6_87bd_6dd7f2c0d812
  5edb0303_45e4_5062_19ee_ebe5bd16f245["justHeadersNoData()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| 5edb0303_45e4_5062_19ee_ebe5bd16f245
  0487b9a3_7697_d065_b6be_39820c13f8e4["gzipEncodingSingleEmptyMessage()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| 0487b9a3_7697_d065_b6be_39820c13f8e4
  0e54844b_d644_9c2a_2505_85040149b760["gzipEncodingSingleMessage()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| 0e54844b_d644_9c2a_2505_85040149b760
  c68bf5cb_0ef0_daa4_a6b6_ce9d8e29128c["gzipEncodingMultipleMessages()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| c68bf5cb_0ef0_daa4_a6b6_ce9d8e29128c
  3b058172_a6e6_4c6b_fb5e_b7abfa77d002["brotliEncodingSingleEmptyMessage()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| 3b058172_a6e6_4c6b_fb5e_b7abfa77d002
  11ac6f49_87c3_d7c4_7923_6055ad0c8cb9["brotliEncodingSingleMessage()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| 11ac6f49_87c3_d7c4_7923_6055ad0c8cb9
  7bb3714d_a9a8_5f8a_b02a_ea3f6d633d42["zstdEncodingSingleEmptyMessage()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| 7bb3714d_a9a8_5f8a_b02a_ea3f6d633d42
  d961ecc6_a849_91f1_c87d_9920dbee529d["zstdEncodingSingleMessage()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| d961ecc6_a849_91f1_c87d_9920dbee529d
  77910e6c_70ed_9248_4483_cb4b004fa67d["snappyEncodingSingleEmptyMessage()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155 -->|method| 77910e6c_70ed_9248_4483_cb4b004fa67d

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/DataCompressionHttp2Test.java lines 72–534

public class DataCompressionHttp2Test {
    private static final AsciiString GET = new AsciiString("GET");
    private static final AsciiString POST = new AsciiString("POST");
    private static final AsciiString PATH = new AsciiString("/some/path");

    @Mock
    private Http2FrameListener serverListener;
    @Mock
    private Http2FrameListener clientListener;

    private Http2ConnectionEncoder clientEncoder;
    private ServerBootstrap sb;
    private Bootstrap cb;
    private Channel serverChannel;
    private Channel clientChannel;
    private volatile Channel serverConnectedChannel;
    private CountDownLatch serverLatch;
    private Http2Connection serverConnection;
    private Http2Connection clientConnection;
    private Http2ConnectionHandler clientHandler;
    private ByteArrayOutputStream serverOut;

    @BeforeAll
    public static void beforeAllTests() throws Throwable {
        Brotli.ensureAvailability();
    }

    @BeforeEach
    public void setup() throws InterruptedException, Http2Exception {
        MockitoAnnotations.initMocks(this);
        doAnswer(new Answer<Void>() {
            @Override
            public Void answer(InvocationOnMock invocation) throws Throwable {
                if (invocation.getArgument(4)) {
                    serverConnection.stream((Integer) invocation.getArgument(1)).close();
                }
                return null;
            }
        }).when(serverListener).onHeadersRead(any(ChannelHandlerContext.class), anyInt(), any(Http2Headers.class),
                anyInt(), anyBoolean());
        doAnswer(new Answer<Void>() {
            @Override
            public Void answer(InvocationOnMock invocation) throws Throwable {
                if (invocation.getArgument(7)) {
                    serverConnection.stream((Integer) invocation.getArgument(1)).close();
                }
                return null;
            }
        }).when(serverListener).onHeadersRead(any(ChannelHandlerContext.class), anyInt(), any(Http2Headers.class),
                anyInt(), anyShort(), anyBoolean(), anyInt(), anyBoolean());
    }

    @AfterEach
    public void cleanup() throws IOException {
        serverOut.close();
    }

    @AfterEach
    public void teardown() throws InterruptedException {
        if (clientChannel != null) {
            clientChannel.close().sync();
            clientChannel = null;
        }
        if (serverChannel != null) {
            serverChannel.close().sync();
            serverChannel = null;
        }
        final Channel serverConnectedChannel = this.serverConnectedChannel;
        if (serverConnectedChannel != null) {
            serverConnectedChannel.close().sync();
            this.serverConnectedChannel = null;
        }
        Future<?> serverGroup = sb.config().group().shutdownGracefully(0, 0, MILLISECONDS);
        Future<?> serverChildGroup = sb.config().childGroup().shutdownGracefully(0, 0, MILLISECONDS);
        Future<?> clientGroup = cb.config().group().shutdownGracefully(0, 0, MILLISECONDS);
        serverGroup.sync();
        serverChildGroup.sync();
        clientGroup.sync();
    }

    @Test

Frequently Asked Questions

What is the DataCompressionHttp2Test class?
DataCompressionHttp2Test is a class in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DataCompressionHttp2Test.java.
Where is DataCompressionHttp2Test defined?
DataCompressionHttp2Test is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DataCompressionHttp2Test.java at line 72.

Analyze Your Own Codebase

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

Try Supermodel Free