testConnectWith0RTT() — netty Function Reference
Architecture documentation for the testConnectWith0RTT() function in QuicChannelConnectTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 7aa218e9_1379_cb51_497d_5a9d99a4ccd1["testConnectWith0RTT()"] 1e1bc485_1969_4537_ef9b_f28971b2f663["QuicChannelConnectTest"] 7aa218e9_1379_cb51_497d_5a9d99a4ccd1 -->|defined in| 1e1bc485_1969_4537_ef9b_f28971b2f663 98eb9acc_3a7c_151d_faf3_46f710fbdd4f["channelRead()"] 7aa218e9_1379_cb51_497d_5a9d99a4ccd1 -->|calls| 98eb9acc_3a7c_151d_faf3_46f710fbdd4f a887d229_3e28_fe9e_0a77_6b48d0666fc3["awaitAndCheckError()"] 7aa218e9_1379_cb51_497d_5a9d99a4ccd1 -->|calls| a887d229_3e28_fe9e_0a77_6b48d0666fc3 f4776383_2a2c_409c_80cc_6e7b63f7a62f["channelActive()"] 7aa218e9_1379_cb51_497d_5a9d99a4ccd1 -->|calls| f4776383_2a2c_409c_80cc_6e7b63f7a62f style 7aa218e9_1379_cb51_497d_5a9d99a4ccd1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java lines 851–983
@ParameterizedTest
@MethodSource("newSslTaskExecutors")
public void testConnectWith0RTT(Executor executor) throws Throwable {
final CountDownLatch readLatch = new CountDownLatch(1);
Channel server = QuicTestUtils.newServer(QuicTestUtils.newQuicServerBuilder(executor,
QuicSslContextBuilder.forServer(
QuicTestUtils.SELF_SIGNED_CERTIFICATE.privateKey(), null,
QuicTestUtils.SELF_SIGNED_CERTIFICATE.certificate())
.applicationProtocols(QuicTestUtils.PROTOS)
.earlyData(true)
.build()),
TestQuicTokenHandler.INSTANCE, new ChannelInboundHandlerAdapter() {
@Override
public boolean isSharable() {
return true;
}
}, new ChannelInboundHandlerAdapter() {
@Override
public boolean isSharable() {
return true;
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
ByteBuf buffer = (ByteBuf) msg;
try {
assertEquals(4, buffer.readableBytes());
assertEquals(1, buffer.readInt());
readLatch.countDown();
ctx.close();
ctx.channel().parent().close();
} finally {
buffer.release();
}
}
});
InetSocketAddress address = (InetSocketAddress) server.localAddress();
QuicSslContext sslContext = QuicSslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.applicationProtocols(QuicTestUtils.PROTOS)
.earlyData(true)
.build();
Channel channel = QuicTestUtils.newClient(QuicTestUtils.newQuicClientBuilder(executor, sslContext)
.sslEngineProvider(q -> sslContext.newEngine(q.alloc(), "localhost", 9999)));
final CountDownLatch activeLatch = new CountDownLatch(1);
final CountDownLatch eventLatch = new CountDownLatch(1);
final CountDownLatch streamLatch = new CountDownLatch(1);
final AtomicReference<Throwable> errorRef = new AtomicReference<>();
try {
QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel)
.handler(new ChannelInboundHandlerAdapter() {
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof SslEarlyDataReadyEvent) {
errorRef.set(new AssertionFailedError("Shouldn't be called on the first connection"));
}
ctx.fireUserEventTriggered(evt);
}
})
.streamHandler(new ChannelInboundHandlerAdapter())
.remoteAddress(address)
.connect()
.get();
QuicClientSessionCache cache = ((QuicheQuicSslContext) sslContext).getSessionCache();
// Let's spin until the session shows up in the cache. This is needed as this might happen a bit after
// the connection is already established.
// See https://commondatastorage.googleapis.com/chromium-boringssl-docs/ssl.h.html#SSL_CTX_sess_set_new_cb
while (!cache.hasSession("localhost", 9999)) {
// Check again in 100ms.
Thread.sleep(100);
}
quicChannel.close().sync();
if (errorRef.get() != null) {
throw errorRef.get();
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testConnectWith0RTT() do?
testConnectWith0RTT() is a function in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java.
Where is testConnectWith0RTT() defined?
testConnectWith0RTT() is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java at line 851.
What does testConnectWith0RTT() call?
testConnectWith0RTT() calls 3 function(s): awaitAndCheckError, channelActive, channelRead.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free