Home / Function/ asyncSettingsAck0() — netty Function Reference

asyncSettingsAck0() — netty Function Reference

Architecture documentation for the asyncSettingsAck0() function in Http2MultiplexTransportTest.java from the netty codebase.

Function java Buffer Allocators calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  244a9744_7e18_7250_b37b_f6158f673bd7["asyncSettingsAck0()"]
  91fc51f7_5bfd_40ef_a0e8_b98c3ed99f48["Http2MultiplexTransportTest"]
  244a9744_7e18_7250_b37b_f6158f673bd7 -->|defined in| 91fc51f7_5bfd_40ef_a0e8_b98c3ed99f48
  fd9d7fc2_4335_351c_a33d_a3adef22e58d["asyncSettingsAckWithMultiplexCodec()"]
  fd9d7fc2_4335_351c_a33d_a3adef22e58d -->|calls| 244a9744_7e18_7250_b37b_f6158f673bd7
  1183eb2a_52be_6c73_c0e1_52805101568d["asyncSettingsAckWithMultiplexHandler()"]
  1183eb2a_52be_6c73_c0e1_52805101568d -->|calls| 244a9744_7e18_7250_b37b_f6158f673bd7
  ddc09e7c_92de_4aa4_bf62_25ac0d49ef36["channelRead()"]
  244a9744_7e18_7250_b37b_f6158f673bd7 -->|calls| ddc09e7c_92de_4aa4_bf62_25ac0d49ef36
  style 244a9744_7e18_7250_b37b_f6158f673bd7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java lines 197–272

    private void asyncSettingsAck0(final Http2FrameCodec codec, final ChannelHandler multiplexer)
            throws InterruptedException {
        // The client expects 2 settings frames. One from the connection setup and one from this test.
        final CountDownLatch serverAckOneLatch = new CountDownLatch(1);
        final CountDownLatch serverAckAllLatch = new CountDownLatch(2);
        final CountDownLatch clientSettingsLatch = new CountDownLatch(2);
        final CountDownLatch serverConnectedChannelLatch = new CountDownLatch(1);
        final AtomicReference<Channel> serverConnectedChannelRef = new AtomicReference<Channel>();
        ServerBootstrap sb = new ServerBootstrap();
        sb.group(eventLoopGroup);
        sb.channel(NioServerSocketChannel.class);
        sb.childHandler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) {
                ch.pipeline().addLast(codec);
                if (multiplexer != null) {
                    ch.pipeline().addLast(multiplexer);
                }
                ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                    @Override
                    public void channelActive(ChannelHandlerContext ctx) {
                        serverConnectedChannelRef.set(ctx.channel());
                        serverConnectedChannelLatch.countDown();
                    }

                    @Override
                    public void channelRead(ChannelHandlerContext ctx, Object msg) {
                        if (msg instanceof Http2SettingsAckFrame) {
                            serverAckOneLatch.countDown();
                            serverAckAllLatch.countDown();
                        }
                        ReferenceCountUtil.release(msg);
                    }
                });
            }
        });
        serverChannel = sb.bind(new InetSocketAddress(NetUtil.LOCALHOST, 0)).awaitUninterruptibly().channel();

        Bootstrap bs = new Bootstrap();
        bs.group(eventLoopGroup);
        bs.channel(NioSocketChannel.class);
        bs.handler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) {
                ch.pipeline().addLast(Http2MultiplexCodecBuilder
                        .forClient(DISCARD_HANDLER).autoAckSettingsFrame(false).build());
                ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                    @Override
                    public void channelRead(ChannelHandlerContext ctx, Object msg) {
                        if (msg instanceof Http2SettingsFrame) {
                            clientSettingsLatch.countDown();
                        }
                        ReferenceCountUtil.release(msg);
                    }
                });
            }
        });
        clientChannel = bs.connect(serverChannel.localAddress()).awaitUninterruptibly().channel();
        serverConnectedChannelLatch.await();
        serverConnectedChannel = serverConnectedChannelRef.get();

        serverConnectedChannel.writeAndFlush(new DefaultHttp2SettingsFrame(new Http2Settings()
                .maxConcurrentStreams(10))).sync();

        clientSettingsLatch.await();

        // We expect a timeout here because we want to asynchronously generate the SETTINGS ACK below.
        assertFalse(serverAckOneLatch.await(300, MILLISECONDS));

        // We expect 2 settings frames, the initial settings frame during connection establishment and the setting frame
        // written in this test. We should ack both of these settings frames.
        clientChannel.writeAndFlush(Http2SettingsAckFrame.INSTANCE).sync();
        clientChannel.writeAndFlush(Http2SettingsAckFrame.INSTANCE).sync();

        serverAckAllLatch.await();
    }

Domain

Subdomains

Frequently Asked Questions

What does asyncSettingsAck0() do?
asyncSettingsAck0() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java.
Where is asyncSettingsAck0() defined?
asyncSettingsAck0() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexTransportTest.java at line 197.
What does asyncSettingsAck0() call?
asyncSettingsAck0() calls 1 function(s): channelRead.
What calls asyncSettingsAck0()?
asyncSettingsAck0() is called by 2 function(s): asyncSettingsAckWithMultiplexCodec, asyncSettingsAckWithMultiplexHandler.

Analyze Your Own Codebase

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

Try Supermodel Free