QuicTestUtils Class — netty Architecture
Architecture documentation for the QuicTestUtils class in QuicTestUtils.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 0d70133d_6f8b_a960_819e_56bb9eb22abe["QuicTestUtils"] 708f532f_8caf_de3b_4d79_5c5f8017207f["QuicTestUtils.java"] 0d70133d_6f8b_a960_819e_56bb9eb22abe -->|defined in| 708f532f_8caf_de3b_4d79_5c5f8017207f 8293fdf5_a7dc_500d_2277_bb72e7eb2d0c["QuicTestUtils()"] 0d70133d_6f8b_a960_819e_56bb9eb22abe -->|method| 8293fdf5_a7dc_500d_2277_bb72e7eb2d0c e5db32dc_e973_45cd_df6d_ddae218dc601["Channel()"] 0d70133d_6f8b_a960_819e_56bb9eb22abe -->|method| e5db32dc_e973_45cd_df6d_ddae218dc601 9bd8fc50_640c_5819_dbba_5d00fdb9750b["Bootstrap()"] 0d70133d_6f8b_a960_819e_56bb9eb22abe -->|method| 9bd8fc50_640c_5819_dbba_5d00fdb9750b 1b9a78bb_0f52_1f46_72f7_86072f212240["QuicChannelBootstrap()"] 0d70133d_6f8b_a960_819e_56bb9eb22abe -->|method| 1b9a78bb_0f52_1f46_72f7_86072f212240 35e94f85_a2b1_9924_4285_840710007f25["QuicClientCodecBuilder()"] 0d70133d_6f8b_a960_819e_56bb9eb22abe -->|method| 35e94f85_a2b1_9924_4285_840710007f25 994fc075_a3e0_9560_c149_1020020af813["QuicServerCodecBuilder()"] 0d70133d_6f8b_a960_819e_56bb9eb22abe -->|method| 994fc075_a3e0_9560_c149_1020020af813 8e3dcf82_9a0b_9b10_b386_cbe9c0e735e4["closeIfNotNull()"] 0d70133d_6f8b_a960_819e_56bb9eb22abe -->|method| 8e3dcf82_9a0b_9b10_b386_cbe9c0e735e4 09f7004a_f676_91ee_5022_14155c76ce84["soReusePortOption()"] 0d70133d_6f8b_a960_819e_56bb9eb22abe -->|method| 09f7004a_f676_91ee_5022_14155c76ce84
Relationship Graph
Source Code
codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicTestUtils.java lines 41–210
final class QuicTestUtils {
static final String[] PROTOS = new String[]{"hq-29"};
static final SelfSignedCertificate SELF_SIGNED_CERTIFICATE;
private static final int DATAGRAM_SIZE = 2048;
static {
SelfSignedCertificate cert;
try {
cert = new SelfSignedCertificate();
} catch (Exception e) {
throw new ExceptionInInitializerError(e);
}
SELF_SIGNED_CERTIFICATE = cert;
}
private QuicTestUtils() {
}
private static final EventLoopGroup GROUP = Epoll.isAvailable() ?
new MultiThreadIoEventLoopGroup(EpollIoHandler.newFactory()) :
new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
static final ChannelHandlerAdapter NOOP_HANDLER = new ChannelHandlerAdapter() {
@Override
public boolean isSharable() {
return true;
}
};
static {
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
try {
GROUP.shutdownGracefully().sync();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
});
}
static Channel newClient(Executor sslTaskExecutor) throws Exception {
return newClient(newQuicClientBuilder(sslTaskExecutor));
}
private static Bootstrap newBootstrap() {
Bootstrap bs = new Bootstrap();
if (Epoll.isAvailable()) {
bs.channel(EpollDatagramChannel.class)
// Use recvmmsg when possible.
.option(EpollChannelOption.MAX_DATAGRAM_PAYLOAD_SIZE, DATAGRAM_SIZE)
.option(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(DATAGRAM_SIZE * 8));
} else {
bs.channel(NioDatagramChannel.class)
.option(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(DATAGRAM_SIZE));
}
return bs.group(GROUP);
}
static Channel newClient(QuicClientCodecBuilder builder) throws Exception {
return newBootstrap()
// We don't want any special handling of the channel so just use a dummy handler.
.handler(builder.build())
.bind(new InetSocketAddress(NetUtil.LOCALHOST4, 0)).sync().channel();
}
static QuicChannelBootstrap newQuicChannelBootstrap(Channel channel) {
QuicChannelBootstrap bs = QuicChannel.newBootstrap(channel);
if (Epoll.isAvailable()) {
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());
}
Source
Frequently Asked Questions
What is the QuicTestUtils class?
QuicTestUtils is a class in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicTestUtils.java.
Where is QuicTestUtils defined?
QuicTestUtils is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicTestUtils.java at line 41.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free