testALPNProtocolMissmatch() — netty Function Reference
Architecture documentation for the testALPNProtocolMissmatch() function in QuicChannelConnectTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD b66c47bf_b8b9_427f_0751_880e5d17347d["testALPNProtocolMissmatch()"] 1e1bc485_1969_4537_ef9b_f28971b2f663["QuicChannelConnectTest"] b66c47bf_b8b9_427f_0751_880e5d17347d -->|defined in| 1e1bc485_1969_4537_ef9b_f28971b2f663 c6ec3ec0_2d6d_3639_c4e3_86428a4b30c8["exceptionCaught()"] b66c47bf_b8b9_427f_0751_880e5d17347d -->|calls| c6ec3ec0_2d6d_3639_c4e3_86428a4b30c8 style b66c47bf_b8b9_427f_0751_880e5d17347d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java lines 1127–1198
@ParameterizedTest
@MethodSource("newSslTaskExecutors")
public void testALPNProtocolMissmatch(Executor executor) throws Throwable {
CountDownLatch latch = new CountDownLatch(1);
CountDownLatch eventLatch = new CountDownLatch(1);
Channel server = QuicTestUtils.newServer(QuicTestUtils.newQuicServerBuilder(executor,
QuicSslContextBuilder.forServer(
QuicTestUtils.SELF_SIGNED_CERTIFICATE.privateKey(), null,
QuicTestUtils.SELF_SIGNED_CERTIFICATE.certificate())
.applicationProtocols("my-protocol").build()),
TestQuicTokenHandler.INSTANCE, new ChannelInboundHandlerAdapter() {
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof SslHandshakeCompletionEvent) {
if (((SslHandshakeCompletionEvent) evt).cause() instanceof SSLHandshakeException) {
eventLatch.countDown();
return;
}
}
ctx.fireUserEventTriggered(evt);
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
if (cause instanceof SSLHandshakeException) {
latch.countDown();
} else {
ctx.fireExceptionCaught(cause);
}
}
},
new ChannelInboundHandlerAdapter());
InetSocketAddress address = (InetSocketAddress) server.localAddress();
Channel channel = QuicTestUtils.newClient(QuicTestUtils.newQuicClientBuilder(executor,
QuicSslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE).applicationProtocols("protocol").build()));
AtomicReference<QuicConnectionCloseEvent> closeEventRef = new AtomicReference<>();
try {
Throwable cause = QuicTestUtils.newQuicChannelBootstrap(channel)
.handler(new ChannelInboundHandlerAdapter() {
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
if (evt instanceof QuicConnectionCloseEvent) {
closeEventRef.set((QuicConnectionCloseEvent) evt);
}
super.userEventTriggered(ctx, evt);
}
})
.streamHandler(new ChannelInboundHandlerAdapter())
.remoteAddress(address)
.connect()
.await().cause();
assertInstanceOf(ClosedChannelException.class, cause);
latch.await();
eventLatch.await();
QuicConnectionCloseEvent closeEvent = closeEventRef.get();
assertNotNull(closeEvent);
assertTrue(closeEvent.isTlsError());
// 120 is the ALPN error.
// See https://datatracker.ietf.org/doc/html/rfc8446#section-6
assertEquals(120, QuicConnectionCloseEvent.extractTlsError(closeEvent.error()));
assertEquals(closeEvent, ((QuicClosedChannelException) cause).event());
} 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 testALPNProtocolMissmatch() do?
testALPNProtocolMissmatch() is a function in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java.
Where is testALPNProtocolMissmatch() defined?
testALPNProtocolMissmatch() is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java at line 1127.
What does testALPNProtocolMissmatch() call?
testALPNProtocolMissmatch() calls 1 function(s): exceptionCaught.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free