Home / Function/ testConnectWithoutTokenValidation() — netty Function Reference

testConnectWithoutTokenValidation() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a0847459_3ad2_39b2_ba20_746c3c7ada76["testConnectWithoutTokenValidation()"]
  1e1bc485_1969_4537_ef9b_f28971b2f663["QuicChannelConnectTest"]
  a0847459_3ad2_39b2_ba20_746c3c7ada76 -->|defined in| 1e1bc485_1969_4537_ef9b_f28971b2f663
  50ae9935_9ff5_26ef_46de_b1c885717ce2["BytesCountingHandler()"]
  a0847459_3ad2_39b2_ba20_746c3c7ada76 -->|calls| 50ae9935_9ff5_26ef_46de_b1c885717ce2
  5f0fc68a_3438_a865_1307_d0a3144b2c00["assertState()"]
  a0847459_3ad2_39b2_ba20_746c3c7ada76 -->|calls| 5f0fc68a_3438_a865_1307_d0a3144b2c00
  style a0847459_3ad2_39b2_ba20_746c3c7ada76 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java lines 678–734

    @ParameterizedTest
    @MethodSource("newSslTaskExecutors")
    public void testConnectWithoutTokenValidation(Executor executor) throws Throwable {
        int numBytes = 8;
        ChannelActiveVerifyHandler serverQuicChannelHandler = new ChannelActiveVerifyHandler();
        CountDownLatch serverLatch = new CountDownLatch(1);
        CountDownLatch clientLatch = new CountDownLatch(1);

        // Disable token validation
        Channel server = QuicTestUtils.newServer(executor, NoQuicTokenHandler.INSTANCE,
                serverQuicChannelHandler, new BytesCountingHandler(serverLatch, numBytes));
        InetSocketAddress address = (InetSocketAddress) server.localAddress();
        Channel channel = QuicTestUtils.newClient(executor);
        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);
        } finally {
            serverLatch.await();

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

            shutdown(executor);
        }
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free