From c05a671e9b96d61d0d177a81b74f6f4ef50c106b Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 24 May 2023 12:21:51 +0200 Subject: [PATCH] Enable UDP_SEGMENT when supported during testing (#515) Motivation: We should enable UDP_SEGMENT on the client side as well when its supported during testing. Modifications: Add utility method that enables UDP_SEGMENT for the client side when testing Result: Better test coverage --- .../codec/quic/QuicChannelConnectTest.java | 38 +++++++++---------- .../codec/quic/QuicChannelDatagramTest.java | 4 +- .../codec/quic/QuicChannelEchoTest.java | 4 +- .../codec/quic/QuicConnectionStatsTest.java | 2 +- .../codec/quic/QuicReadableTest.java | 2 +- .../quic/QuicStreamChannelCloseTest.java | 4 +- .../quic/QuicStreamChannelCreationTest.java | 4 +- .../codec/quic/QuicStreamFrameTest.java | 2 +- .../codec/quic/QuicStreamHalfClosureTest.java | 2 +- .../codec/quic/QuicStreamLimitTest.java | 4 +- .../codec/quic/QuicStreamTypeTest.java | 4 +- .../incubator/codec/quic/QuicTestUtils.java | 9 +++++ .../codec/quic/QuicWritableTest.java | 4 +- 13 files changed, 46 insertions(+), 37 deletions(-) diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicChannelConnectTest.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicChannelConnectTest.java index 06fec575a..b1139a020 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicChannelConnectTest.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicChannelConnectTest.java @@ -127,7 +127,7 @@ private void testQLog(Executor executor, Path path, Consumer consumer) thr InetSocketAddress address = (InetSocketAddress) server.localAddress(); Channel channel = QuicTestUtils.newClient(executor); try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientValidationHandler) .option(QuicChannelOption.QLOG, new QLogConfiguration(path.toString(), "testTitle", "test")) @@ -199,7 +199,7 @@ private static void testKeylog(Executor sslTaskExecutor, Object keylog) throws T Channel channel = QuicTestUtils.newClient(QuicTestUtils.newQuicClientBuilder(sslTaskExecutor, context)); try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientValidationHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -228,7 +228,7 @@ public void testAddressValidation(Executor executor) throws Throwable { .localConnectionIdLength(10)); try { ChannelStateVerifyHandler verifyHandler = new ChannelStateVerifyHandler(); - Future future = QuicChannel.newBootstrap(channel) + Future future = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(verifyHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(socket.getLocalSocketAddress()) @@ -269,7 +269,7 @@ private static void testConnectWithCustomIdLength(Executor executor, int idLengt .localConnectionIdLength(idLength)); try { ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler(); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientQuicChannelHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -336,7 +336,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) { Channel channel = QuicTestUtils.newClient(QuicTestUtils.newQuicClientBuilder(executor)); ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler(); try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientQuicChannelHandler) .remoteAddress(address) .connect() @@ -396,7 +396,7 @@ public void testConnectTimeout(Executor executor) throws Throwable { Channel channel = QuicTestUtils.newClient(executor); try { ChannelStateVerifyHandler verifyHandler = new ChannelStateVerifyHandler(); - Future future = QuicChannel.newBootstrap(channel) + Future future = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(verifyHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10) @@ -425,7 +425,7 @@ public void testConnectAlreadyConnected(Executor executor) throws Throwable { Channel channel = QuicTestUtils.newClient(executor); try { ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler(); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientQuicChannelHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -466,7 +466,7 @@ public void testConnectWithoutTokenValidation(Executor executor) throws Throwabl Channel channel = QuicTestUtils.newClient(executor); try { ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler(); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientQuicChannelHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -537,7 +537,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc InetSocketAddress address = (InetSocketAddress) server.localAddress(); Channel channel = QuicTestUtils.newClient(executor); try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(new ChannelInboundHandlerAdapter()) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -584,7 +584,7 @@ public void testConnectAndStreamPriority(Executor executor) throws Throwable { Channel channel = QuicTestUtils.newClient(executor); try { ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler(); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientQuicChannelHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -658,7 +658,7 @@ public void checkServerTrusted(X509Certificate[] chain, String authType) .trustManager(new TrustManagerFactoryWrapper(trustManager)) .applicationProtocols(QuicTestUtils.PROTOS).build())); try { - Throwable cause = QuicChannel.newBootstrap(channel) + Throwable cause = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(new ChannelInboundHandlerAdapter()) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -714,7 +714,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { .trustManager(InsecureTrustManagerFactory.INSTANCE).applicationProtocols("protocol").build())); AtomicReference closeEventRef = new AtomicReference<>(); try { - Throwable cause = QuicChannel.newBootstrap(channel) + Throwable cause = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(new ChannelInboundHandlerAdapter() { @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { @@ -765,7 +765,7 @@ InsecureQuicTokenHandler.INSTANCE, new ChannelInboundHandlerAdapter(), .applicationProtocols(QuicTestUtils.PROTOS).build())); try { ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler(); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientQuicChannelHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -805,7 +805,7 @@ InsecureQuicTokenHandler.INSTANCE, new ChannelInboundHandlerAdapter(), .applicationProtocols(QuicTestUtils.PROTOS).build())); try { ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler(); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientQuicChannelHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -841,7 +841,7 @@ InsecureQuicTokenHandler.INSTANCE, new ChannelInboundHandlerAdapter(), .trustManager(InsecureTrustManagerFactory.INSTANCE) .applicationProtocols(QuicTestUtils.PROTOS).build())); try { - Throwable cause = QuicChannel.newBootstrap(channel) + Throwable cause = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(new ChannelInboundHandlerAdapter()) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -904,7 +904,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc .sslEngineProvider(c -> clientSslContext.newEngine(c.alloc(), hostname, 8080))); try { ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler(); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientQuicChannelHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -972,7 +972,7 @@ InsecureQuicTokenHandler.INSTANCE, new ChannelInboundHandlerAdapter(), })); try { ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler(); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientQuicChannelHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -1066,7 +1066,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { .applicationProtocols(QuicTestUtils.PROTOS).build())); try { ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler(); - Future connectFuture = QuicChannel.newBootstrap(channel) + Future connectFuture = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientQuicChannelHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -1135,7 +1135,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc try { CountDownLatch clientSslCompletionEventLatch = new CountDownLatch(2); - QuicChannelBootstrap bootstrap = QuicChannel.newBootstrap(channel) + QuicChannelBootstrap bootstrap = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(new ChannelInboundHandlerAdapter() { @Override public boolean isSharable() { diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicChannelDatagramTest.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicChannelDatagramTest.java index c707b5964..54bfb1eed 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicChannelDatagramTest.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicChannelDatagramTest.java @@ -130,7 +130,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { }; try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .remoteAddress(address) .connect() @@ -268,7 +268,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { } }; try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .remoteAddress(address) .connect() diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicChannelEchoTest.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicChannelEchoTest.java index f4d400527..d70fe32e4 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicChannelEchoTest.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicChannelEchoTest.java @@ -149,7 +149,7 @@ public void channelReadComplete(ChannelHandlerContext ctx) { Channel channel = QuicTestUtils.newClient(ImmediateExecutor.INSTANCE); QuicChannel quicChannel = null; try { - quicChannel = QuicChannel.newBootstrap(channel) + quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(new ChannelInboundHandlerAdapter() { @Override public void channelActive(ChannelHandlerContext ctx) { @@ -257,7 +257,7 @@ public void channelReadComplete(ChannelHandlerContext ctx) { } } }; - quicChannel = QuicChannel.newBootstrap(channel) + quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(ch) // Use the same allocator for the streams. diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicConnectionStatsTest.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicConnectionStatsTest.java index ad1f3d845..774818958 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicConnectionStatsTest.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicConnectionStatsTest.java @@ -86,7 +86,7 @@ public boolean isSharable() { }); channel = QuicTestUtils.newClient(executor); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(server.localAddress()) diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicReadableTest.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicReadableTest.java index 179d45ed2..1ff9d730e 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicReadableTest.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicReadableTest.java @@ -87,7 +87,7 @@ public boolean isSharable() { QuicChannelValidationHandler clientHandler = new QuicChannelValidationHandler(); ByteBuf data = Unpooled.directBuffer().writeLong(8); try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(server.localAddress()) diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamChannelCloseTest.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamChannelCloseTest.java index 9d5b0772c..129f2d8d2 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamChannelCloseTest.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamChannelCloseTest.java @@ -70,7 +70,7 @@ private static void testCloseFromServerWhileInActive(Executor executor, QuicStre QuicChannelValidationHandler clientHandler = new QuicChannelValidationHandler(); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new StreamHandler()) .remoteAddress(server.localAddress()) @@ -132,7 +132,7 @@ private static void testCloseFromClientWhileInActive(Executor executor, QuicStre channel = QuicTestUtils.newClient(executor); StreamCreationHandler creationHandler = new StreamCreationHandler(type, halfClose, streamPromise); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(creationHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(server.localAddress()) diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamChannelCreationTest.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamChannelCreationTest.java index 1dbf2abd7..edcb03e95 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamChannelCreationTest.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamChannelCreationTest.java @@ -45,7 +45,7 @@ public void testCreateStream(Executor executor) throws Throwable { QuicChannelValidationHandler clientHandler = new QuicChannelValidationHandler(); try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -88,7 +88,7 @@ public void testCreateStreamViaBootstrap(Executor executor) throws Throwable { QuicChannelValidationHandler clientHandler = new QuicChannelValidationHandler(); try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamFrameTest.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamFrameTest.java index 19d469dea..d81ca5748 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamFrameTest.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamFrameTest.java @@ -54,7 +54,7 @@ private static void testCloseHalfClosure(Executor executor, QuicStreamType type) StreamHandler handler = new StreamHandler(); server = QuicTestUtils.newServer(executor, serverHandler, handler); channel = QuicTestUtils.newClient(executor); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(server.localAddress()) diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamHalfClosureTest.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamHalfClosureTest.java index 4da210ffd..625064dd7 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamHalfClosureTest.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamHalfClosureTest.java @@ -56,7 +56,7 @@ private static void testCloseHalfClosure(Executor executor, QuicStreamType type) StreamHandler handler = new StreamHandler(); server = QuicTestUtils.newServer(executor, serverHandler, handler); channel = QuicTestUtils.newClient(executor); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(server.localAddress()) diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamLimitTest.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamLimitTest.java index 90e3770a1..413c66b4c 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamLimitTest.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamLimitTest.java @@ -86,7 +86,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc } }; try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -170,7 +170,7 @@ public boolean isSharable() { QuicChannelValidationHandler clientHandler = new QuicChannelValidationHandler(); try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamTypeTest.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamTypeTest.java index 055d157f9..68163f53c 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamTypeTest.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicStreamTypeTest.java @@ -64,7 +64,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) { }); channel = QuicTestUtils.newClient(executor); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(server.localAddress()) @@ -116,7 +116,7 @@ public void channelActive(ChannelHandlerContext ctx) { server = QuicTestUtils.newServer(executor, serverHandler, new ChannelInboundHandlerAdapter()); channel = QuicTestUtils.newClient(executor); - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new ChannelInboundHandlerAdapter() { @Override diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicTestUtils.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicTestUtils.java index a891cceec..a57605d94 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicTestUtils.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicTestUtils.java @@ -73,6 +73,15 @@ static Channel newClient(QuicClientCodecBuilder builder) throws Exception { .bind(new InetSocketAddress(NetUtil.LOCALHOST4, 0)).sync().channel(); } + static QuicChannelBootstrap newQuicChannelBootstrap(Channel channel) { + QuicChannelBootstrap bs = QuicChannel.newBootstrap(channel); + if (GROUP instanceof EpollEventLoopGroup) { + bs.option(QuicChannelOption.SEGMENTED_DATAGRAM_PACKET_ALLOCATOR, + EpollQuicUtils.newSegmentedAllocator(10)); + } + return bs; + } + static QuicClientCodecBuilder newQuicClientBuilder(Executor sslTaskExecutor) { return newQuicClientBuilder(sslTaskExecutor, QuicSslContextBuilder.forClient() .trustManager(InsecureTrustManagerFactory.INSTANCE).applicationProtocols(PROTOS).build()); diff --git a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicWritableTest.java b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicWritableTest.java index db3f08933..dca7fc80e 100644 --- a/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicWritableTest.java +++ b/codec-native-quic/src/test/java/io/netty/incubator/codec/quic/QuicWritableTest.java @@ -87,7 +87,7 @@ public boolean isSharable() { QuicChannelValidationHandler clientHandler = new QuicChannelValidationHandler(); try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address) @@ -227,7 +227,7 @@ public boolean isSharable() { QuicChannelValidationHandler clientHandler = new QuicChannelValidationHandler(); try { - QuicChannel quicChannel = QuicChannel.newBootstrap(channel) + QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel) .handler(clientHandler) .streamHandler(new ChannelInboundHandlerAdapter()) .remoteAddress(address)