Home / Function/ bootstrapEnv() — netty Function Reference

bootstrapEnv() — netty Function Reference

Architecture documentation for the bootstrapEnv() function in DataCompressionHttp2Test.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b8de372e_82cf_de6a_5ac0_bd9a46f8e461["bootstrapEnv()"]
  9e639957_0a4c_c19f_71db_e7a3e405c155["DataCompressionHttp2Test"]
  b8de372e_82cf_de6a_5ac0_bd9a46f8e461 -->|defined in| 9e639957_0a4c_c19f_71db_e7a3e405c155
  5edb0303_45e4_5062_19ee_ebe5bd16f245["justHeadersNoData()"]
  5edb0303_45e4_5062_19ee_ebe5bd16f245 -->|calls| b8de372e_82cf_de6a_5ac0_bd9a46f8e461
  0487b9a3_7697_d065_b6be_39820c13f8e4["gzipEncodingSingleEmptyMessage()"]
  0487b9a3_7697_d065_b6be_39820c13f8e4 -->|calls| b8de372e_82cf_de6a_5ac0_bd9a46f8e461
  0e54844b_d644_9c2a_2505_85040149b760["gzipEncodingSingleMessage()"]
  0e54844b_d644_9c2a_2505_85040149b760 -->|calls| b8de372e_82cf_de6a_5ac0_bd9a46f8e461
  c68bf5cb_0ef0_daa4_a6b6_ce9d8e29128c["gzipEncodingMultipleMessages()"]
  c68bf5cb_0ef0_daa4_a6b6_ce9d8e29128c -->|calls| b8de372e_82cf_de6a_5ac0_bd9a46f8e461
  3b058172_a6e6_4c6b_fb5e_b7abfa77d002["brotliEncodingSingleEmptyMessage()"]
  3b058172_a6e6_4c6b_fb5e_b7abfa77d002 -->|calls| b8de372e_82cf_de6a_5ac0_bd9a46f8e461
  11ac6f49_87c3_d7c4_7923_6055ad0c8cb9["brotliEncodingSingleMessage()"]
  11ac6f49_87c3_d7c4_7923_6055ad0c8cb9 -->|calls| b8de372e_82cf_de6a_5ac0_bd9a46f8e461
  7bb3714d_a9a8_5f8a_b02a_ea3f6d633d42["zstdEncodingSingleEmptyMessage()"]
  7bb3714d_a9a8_5f8a_b02a_ea3f6d633d42 -->|calls| b8de372e_82cf_de6a_5ac0_bd9a46f8e461
  d961ecc6_a849_91f1_c87d_9920dbee529d["zstdEncodingSingleMessage()"]
  d961ecc6_a849_91f1_c87d_9920dbee529d -->|calls| b8de372e_82cf_de6a_5ac0_bd9a46f8e461
  77910e6c_70ed_9248_4483_cb4b004fa67d["snappyEncodingSingleEmptyMessage()"]
  77910e6c_70ed_9248_4483_cb4b004fa67d -->|calls| b8de372e_82cf_de6a_5ac0_bd9a46f8e461
  a08499b9_9743_4a04_ebf5_749b1c319bd2["snappyEncodingSingleMessage()"]
  a08499b9_9743_4a04_ebf5_749b1c319bd2 -->|calls| b8de372e_82cf_de6a_5ac0_bd9a46f8e461
  e71bee3e_d2a8_fd41_7ce7_253e6d5b1cb2["deflateEncodingWriteLargeMessage()"]
  e71bee3e_d2a8_fd41_7ce7_253e6d5b1cb2 -->|calls| b8de372e_82cf_de6a_5ac0_bd9a46f8e461
  style b8de372e_82cf_de6a_5ac0_bd9a46f8e461 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/DataCompressionHttp2Test.java lines 417–520

    private void bootstrapEnv(int serverOutSize) throws Exception {
        final CountDownLatch prefaceWrittenLatch = new CountDownLatch(1);
        serverOut = new ByteArrayOutputStream(serverOutSize);
        serverLatch = new CountDownLatch(1);
        sb = new ServerBootstrap();
        cb = new Bootstrap();

        // Streams are created before the normal flow for this test, so these connection must be initialized up front.
        serverConnection = new DefaultHttp2Connection(true);
        clientConnection = new DefaultHttp2Connection(false);

        serverConnection.addListener(new Http2ConnectionAdapter() {
            @Override
            public void onStreamClosed(Http2Stream stream) {
                serverLatch.countDown();
            }
        });

        doAnswer(new Answer<Integer>() {
            @Override
            public Integer answer(InvocationOnMock in) throws Throwable {
                ByteBuf buf = (ByteBuf) in.getArguments()[2];
                int padding = (Integer) in.getArguments()[3];
                int processedBytes = buf.readableBytes() + padding;

                buf.readBytes(serverOut, buf.readableBytes());

                if (in.getArgument(4)) {
                    serverConnection.stream((Integer) in.getArgument(1)).close();
                }
                return processedBytes;
            }
        }).when(serverListener).onDataRead(any(ChannelHandlerContext.class), anyInt(),
                any(ByteBuf.class), anyInt(), anyBoolean());

        final CountDownLatch serverChannelLatch = new CountDownLatch(1);
        sb.group(new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory()));
        sb.channel(NioServerSocketChannel.class);
        sb.childHandler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                serverConnectedChannel = ch;
                ChannelPipeline p = ch.pipeline();
                Http2FrameWriter frameWriter = new DefaultHttp2FrameWriter();
                serverConnection.remote().flowController(
                        new DefaultHttp2RemoteFlowController(serverConnection));
                serverConnection.local().flowController(
                        new DefaultHttp2LocalFlowController(serverConnection).frameWriter(frameWriter));
                Http2ConnectionEncoder encoder = new CompressorHttp2ConnectionEncoder(
                        new DefaultHttp2ConnectionEncoder(serverConnection, frameWriter));
                Http2ConnectionDecoder decoder =
                        new DefaultHttp2ConnectionDecoder(serverConnection, encoder, new DefaultHttp2FrameReader());
                Http2ConnectionHandler connectionHandler = new Http2ConnectionHandlerBuilder()
                        .frameListener(new DelegatingDecompressorFrameListener(serverConnection, serverListener, 0))
                        .codec(decoder, encoder).build();
                p.addLast(connectionHandler);
                serverChannelLatch.countDown();
            }
        });

        cb.group(new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory()));
        cb.channel(NioSocketChannel.class);
        cb.handler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();
                Http2FrameWriter frameWriter = new DefaultHttp2FrameWriter();
                clientConnection.remote().flowController(
                        new DefaultHttp2RemoteFlowController(clientConnection));
                clientConnection.local().flowController(
                        new DefaultHttp2LocalFlowController(clientConnection).frameWriter(frameWriter));
                clientEncoder = new CompressorHttp2ConnectionEncoder(
                        new DefaultHttp2ConnectionEncoder(clientConnection, frameWriter));

                Http2ConnectionDecoder decoder =
                        new DefaultHttp2ConnectionDecoder(clientConnection, clientEncoder,
                                new DefaultHttp2FrameReader());
                clientHandler = new Http2ConnectionHandlerBuilder()
                        .frameListener(new DelegatingDecompressorFrameListener(clientConnection, clientListener, 0))
                        // By default tests don't wait for server to gracefully shutdown streams
                        .gracefulShutdownTimeoutMillis(0)

Domain

Subdomains

Frequently Asked Questions

What does bootstrapEnv() do?
bootstrapEnv() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DataCompressionHttp2Test.java.
Where is bootstrapEnv() defined?
bootstrapEnv() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DataCompressionHttp2Test.java at line 417.
What calls bootstrapEnv()?
bootstrapEnv() is called by 11 function(s): brotliEncodingSingleEmptyMessage, brotliEncodingSingleMessage, deflateEncodingWriteLargeMessage, gzipEncodingMultipleMessages, gzipEncodingSingleEmptyMessage, gzipEncodingSingleMessage, justHeadersNoData, snappyEncodingSingleEmptyMessage, and 3 more.

Analyze Your Own Codebase

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

Try Supermodel Free