Home / Function/ testConnectWithActiveConnectionIdLimit() — netty Function Reference

testConnectWithActiveConnectionIdLimit() — netty Function Reference

Architecture documentation for the testConnectWithActiveConnectionIdLimit() function in QuicChannelConnectTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  72055865_bca8_c8ab_3a11_db9184b60c81["testConnectWithActiveConnectionIdLimit()"]
  1e1bc485_1969_4537_ef9b_f28971b2f663["QuicChannelConnectTest"]
  72055865_bca8_c8ab_3a11_db9184b60c81 -->|defined in| 1e1bc485_1969_4537_ef9b_f28971b2f663
  c6ec3ec0_2d6d_3639_c4e3_86428a4b30c8["exceptionCaught()"]
  72055865_bca8_c8ab_3a11_db9184b60c81 -->|calls| c6ec3ec0_2d6d_3639_c4e3_86428a4b30c8
  fb98605a_4433_9d76_14e8_eba0fd10d30d["assertNoException()"]
  72055865_bca8_c8ab_3a11_db9184b60c81 -->|calls| fb98605a_4433_9d76_14e8_eba0fd10d30d
  50ae9935_9ff5_26ef_46de_b1c885717ce2["BytesCountingHandler()"]
  72055865_bca8_c8ab_3a11_db9184b60c81 -->|calls| 50ae9935_9ff5_26ef_46de_b1c885717ce2
  5f0fc68a_3438_a865_1307_d0a3144b2c00["assertState()"]
  72055865_bca8_c8ab_3a11_db9184b60c81 -->|calls| 5f0fc68a_3438_a865_1307_d0a3144b2c00
  style 72055865_bca8_c8ab_3a11_db9184b60c81 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java lines 1804–1888

    @ParameterizedTest
    @MethodSource("newSslTaskExecutors")
    public void testConnectWithActiveConnectionIdLimit(Executor executor) throws Throwable {
        int numBytes = 8;

        class ExceptionHandler extends ChannelInboundHandlerAdapter {

            private final AtomicReference<Throwable> causeRef = new AtomicReference<>();
            @Override
            public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
                causeRef.compareAndSet(null, cause);
            }

            void assertNoException() throws Throwable {
                Throwable t = causeRef.get();
                if (t != null) {
                    fail(t);
                }
            }
        }

        ExceptionHandler serverExceptionHandler = new ExceptionHandler();
        ExceptionHandler clientExceptionHandler = new ExceptionHandler();

        ChannelActiveVerifyHandler serverQuicChannelHandler = new ChannelActiveVerifyHandler();

        CountDownLatch serverLatch = new CountDownLatch(1);
        CountDownLatch clientLatch = new CountDownLatch(1);

        // Disable token validation
        Channel server = QuicTestUtils.newServer(
                QuicTestUtils.newQuicServerBuilder(executor).activeConnectionIdLimit(4), NoQuicTokenHandler.INSTANCE,
                serverQuicChannelHandler, new BytesCountingHandler(serverLatch, numBytes));
        server.pipeline().addLast(serverExceptionHandler);
        InetSocketAddress address = (InetSocketAddress) server.localAddress();
        Channel channel = QuicTestUtils.newClient(
                QuicTestUtils.newQuicClientBuilder(executor).activeConnectionIdLimit(4));
        channel.pipeline().addLast(clientExceptionHandler);
        try {
            ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler();
            QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel)
                    .handler(clientQuicChannelHandler)
                    .streamHandler(new ChannelInboundHandlerAdapter())
                    .remoteAddress(address)
                    .connect()
                    .get();
            QuicConnectionAddress localAddress = (QuicConnectionAddress) quicChannel.localAddress();
            QuicConnectionAddress remoteAddress = (QuicConnectionAddress) quicChannel.remoteAddress();
            assertNotNull(localAddress);
            assertNotNull(remoteAddress);

            QuicStreamChannel stream = quicChannel.createStream(QuicStreamType.BIDIRECTIONAL,
                    new BytesCountingHandler(clientLatch, numBytes)).get();
            stream.writeAndFlush(Unpooled.directBuffer().writeZero(numBytes)).sync();
            clientLatch.await();

            QuicheQuicSslEngine quicheQuicSslEngine = (QuicheQuicSslEngine) quicChannel.sslEngine();
            assertNotNull(quicheQuicSslEngine);
            assertEquals(QuicTestUtils.PROTOS[0],
                    // Just do the cast as getApplicationProtocol() only exists in SSLEngine itself since Java9+ and
                    // we may run on an earlier version
                    quicheQuicSslEngine.getApplicationProtocol());
            stream.close().sync();
            quicChannel.close().sync();
            ChannelFuture closeFuture = quicChannel.closeFuture().await();
            assertTrue(closeFuture.isSuccess());

            clientQuicChannelHandler.assertState();
            serverQuicChannelHandler.assertState();

            assertEquals(serverQuicChannelHandler.localAddress(), remoteAddress);
            assertEquals(serverQuicChannelHandler.remoteAddress(), localAddress);

            serverExceptionHandler.assertNoException();
            clientExceptionHandler.assertNoException();
        } finally {
            serverLatch.await();

            server.close().sync();
            // Close the parent Datagram channel as well.
            channel.close().sync();

Domain

Subdomains

Frequently Asked Questions

What does testConnectWithActiveConnectionIdLimit() do?
testConnectWithActiveConnectionIdLimit() is a function in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java.
Where is testConnectWithActiveConnectionIdLimit() defined?
testConnectWithActiveConnectionIdLimit() is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java at line 1804.
What does testConnectWithActiveConnectionIdLimit() call?
testConnectWithActiveConnectionIdLimit() calls 4 function(s): BytesCountingHandler, assertNoException, assertState, exceptionCaught.

Analyze Your Own Codebase

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

Try Supermodel Free