testSniMatch() — netty Function Reference
Architecture documentation for the testSniMatch() function in QuicChannelConnectTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 22fb0e3a_80c0_e755_95dc_ab7f36157bfe["testSniMatch()"] 1e1bc485_1969_4537_ef9b_f28971b2f663["QuicChannelConnectTest"] 22fb0e3a_80c0_e755_95dc_ab7f36157bfe -->|defined in| 1e1bc485_1969_4537_ef9b_f28971b2f663 5f0fc68a_3438_a865_1307_d0a3144b2c00["assertState()"] 22fb0e3a_80c0_e755_95dc_ab7f36157bfe -->|calls| 5f0fc68a_3438_a865_1307_d0a3144b2c00 style 22fb0e3a_80c0_e755_95dc_ab7f36157bfe fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java lines 1409–1476
@ParameterizedTest
@MethodSource("newSslTaskExecutors")
public void testSniMatch(Executor executor) throws Throwable {
QuicSslContext defaultServerSslContext = QuicSslContextBuilder.forServer(
QuicTestUtils.SELF_SIGNED_CERTIFICATE.privateKey(), null,
QuicTestUtils.SELF_SIGNED_CERTIFICATE.certificate())
.applicationProtocols("default-protocol").build();
QuicSslContext sniServerSslContext = QuicSslContextBuilder.forServer(
QuicTestUtils.SELF_SIGNED_CERTIFICATE.privateKey(), null,
QuicTestUtils.SELF_SIGNED_CERTIFICATE.certificate())
.applicationProtocols("sni-protocol").build();
CountDownLatch sniEventLatch = new CountDownLatch(1);
CountDownLatch sslEventLatch = new CountDownLatch(1);
String hostname = "quic.netty.io";
QuicSslContext serverSslContext = QuicSslContextBuilder.buildForServerWithSni(
new DomainWildcardMappingBuilder<>(defaultServerSslContext)
.add(hostname, sniServerSslContext).build());
Channel server = QuicTestUtils.newServer(QuicTestUtils.newQuicServerBuilder(executor, serverSslContext),
TestQuicTokenHandler.INSTANCE, new ChannelInboundHandlerAdapter() {
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
if (evt instanceof SniCompletionEvent) {
if (hostname.equals(((SniCompletionEvent) evt).hostname())) {
sniEventLatch.countDown();
}
} else if (evt instanceof SslHandshakeCompletionEvent) {
if (((SslHandshakeCompletionEvent) evt).isSuccess()) {
sslEventLatch.countDown();
}
}
super.userEventTriggered(ctx, evt);
}
},
new ChannelInboundHandlerAdapter());
InetSocketAddress address = (InetSocketAddress) server.localAddress();
QuicSslContext clientSslContext = QuicSslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE).applicationProtocols("sni-protocol").build();
Channel channel = QuicTestUtils.newClient(QuicTestUtils.newQuicClientBuilder(executor)
.sslEngineProvider(c -> clientSslContext.newEngine(c.alloc(), hostname, 8080)));
try {
ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler();
QuicChannel quicChannel = QuicTestUtils.newQuicChannelBootstrap(channel)
.handler(clientQuicChannelHandler)
.streamHandler(new ChannelInboundHandlerAdapter())
.remoteAddress(address)
.connect()
.get();
quicChannel.close().sync();
ChannelFuture closeFuture = quicChannel.closeFuture().await();
assertTrue(closeFuture.isSuccess());
clientQuicChannelHandler.assertState();
sniEventLatch.await();
sslEventLatch.await();
} finally {
server.close().sync();
// Close the parent Datagram channel as well.
channel.close().sync();
shutdown(executor);
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does testSniMatch() do?
testSniMatch() is a function in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java.
Where is testSniMatch() defined?
testSniMatch() is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java at line 1409.
What does testSniMatch() call?
testSniMatch() calls 1 function(s): assertState.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free