Home / Class/ QuicConnectionPathStatsTest Class — netty Architecture

QuicConnectionPathStatsTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  1e708fe0_ed9b_fc0a_0a94_fcd4ecfaa0c8["QuicConnectionPathStatsTest"]
  c1986e52_c6f5_b57f_1df9_269f987cb27f["QuicConnectionPathStatsTest.java"]
  1e708fe0_ed9b_fc0a_0a94_fcd4ecfaa0c8 -->|defined in| c1986e52_c6f5_b57f_1df9_269f987cb27f
  a4a299ec_a061_af5d_59ca_5474aa848da9["testPathStatsAreCollected()"]
  1e708fe0_ed9b_fc0a_0a94_fcd4ecfaa0c8 -->|method| a4a299ec_a061_af5d_59ca_5474aa848da9
  c2419d52_6c49_dd66_ef2b_3dfddef1f35f["assertStats()"]
  1e708fe0_ed9b_fc0a_0a94_fcd4ecfaa0c8 -->|method| c2419d52_6c49_dd66_ef2b_3dfddef1f35f

Relationship Graph

Source Code

codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicConnectionPathStatsTest.java lines 36–133

public class QuicConnectionPathStatsTest extends AbstractQuicTest {

    @ParameterizedTest
    @MethodSource("newSslTaskExecutors")
    public void testPathStatsAreCollected(Executor executor) throws Throwable {
        Channel server = null;
        Channel channel = null;
        AtomicInteger counter = new AtomicInteger();

        Promise<QuicConnectionPathStats> serverActiveStats = ImmediateEventExecutor.INSTANCE.newPromise();
        QuicChannelValidationHandler serverHandler = new QuicChannelValidationHandler() {
            @Override
            public void channelActive(ChannelHandlerContext ctx) {
                super.channelActive(ctx);
                collectPathStats(ctx, serverActiveStats);
            }

            private void collectPathStats(ChannelHandlerContext ctx, Promise<QuicConnectionPathStats> promise) {
                QuicheQuicChannel channel = (QuicheQuicChannel) ctx.channel();
                channel.collectPathStats(0, promise);
            }
        };
        QuicChannelValidationHandler clientHandler = new QuicChannelValidationHandler();
        try {
            server = QuicTestUtils.newServer(executor, serverHandler, new ChannelInboundHandlerAdapter() {

                @Override
                public void channelActive(ChannelHandlerContext ctx) {
                    counter.incrementAndGet();
                }

                @Override
                public void channelRead(ChannelHandlerContext ctx, Object msg) {
                    // Let's just echo back the message.
                    ctx.writeAndFlush(msg);
                }

                @Override
                public boolean isSharable() {
                    return true;
                }
            });
            channel = QuicTestUtils.newClient(executor);

            QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel)
                    .handler(clientHandler)
                    .streamHandler(new ChannelInboundHandlerAdapter())
                    .remoteAddress(server.localAddress())
                    .connect().get();
            assertNotNull(quicChannel.collectStats().sync().getNow());
            quicChannel.createStream(QuicStreamType.BIDIRECTIONAL, new ChannelInboundHandlerAdapter() {
                private final int bufferSize = 8;
                private int received;

                @Override
                public void channelActive(ChannelHandlerContext ctx) {
                    ctx.writeAndFlush(Unpooled.buffer().writeZero(bufferSize));
                }

                @Override
                public void channelRead(ChannelHandlerContext ctx, Object msg) {
                    ByteBuf buffer = (ByteBuf) msg;
                    received += buffer.readableBytes();
                    buffer.release();
                    if (received == bufferSize) {
                        ctx.close().addListener((ChannelFuture future) -> {
                            // Close the underlying QuicChannel as well.
                            future.channel().parent().close();
                        });
                    }
                }
            }).sync();

            // Wait until closure
            quicChannel.closeFuture().sync();
            assertStats(serverActiveStats.sync().getNow());
            assertEquals(1, counter.get());

            serverHandler.assertState();
            clientHandler.assertState();
        } finally {

Frequently Asked Questions

What is the QuicConnectionPathStatsTest class?
QuicConnectionPathStatsTest is a class in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicConnectionPathStatsTest.java.
Where is QuicConnectionPathStatsTest defined?
QuicConnectionPathStatsTest is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicConnectionPathStatsTest.java at line 36.

Analyze Your Own Codebase

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

Try Supermodel Free