testConnectKeyless0() — netty Function Reference
Architecture documentation for the testConnectKeyless0() function in QuicChannelConnectTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 85c4da75_cf58_8101_6f8b_953f81bbb9dc["testConnectKeyless0()"] 1e1bc485_1969_4537_ef9b_f28971b2f663["QuicChannelConnectTest"] 85c4da75_cf58_8101_6f8b_953f81bbb9dc -->|defined in| 1e1bc485_1969_4537_ef9b_f28971b2f663 06696ab4_dea5_cdbd_6bc9_2b5504f172ab["testConnectKeyless()"] 06696ab4_dea5_cdbd_6bc9_2b5504f172ab -->|calls| 85c4da75_cf58_8101_6f8b_953f81bbb9dc 0974366d_2455_38c8_53c0_46bf01b23127["testConnectKeylessSignFailure()"] 0974366d_2455_38c8_53c0_46bf01b23127 -->|calls| 85c4da75_cf58_8101_6f8b_953f81bbb9dc c6ec3ec0_2d6d_3639_c4e3_86428a4b30c8["exceptionCaught()"] 85c4da75_cf58_8101_6f8b_953f81bbb9dc -->|calls| c6ec3ec0_2d6d_3639_c4e3_86428a4b30c8 5f0fc68a_3438_a865_1307_d0a3144b2c00["assertState()"] 85c4da75_cf58_8101_6f8b_953f81bbb9dc -->|calls| 5f0fc68a_3438_a865_1307_d0a3144b2c00 style 85c4da75_cf58_8101_6f8b_953f81bbb9dc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java lines 1556–1641
public void testConnectKeyless0(Executor executor, boolean fail) throws Throwable {
AtomicReference<Throwable> causeRef = new AtomicReference<>();
AtomicBoolean signCalled = new AtomicBoolean();
BoringSSLAsyncPrivateKeyMethod keyMethod = new BoringSSLAsyncPrivateKeyMethod() {
@Override
public Future<byte[]> sign(SSLEngine engine, int signatureAlgorithm, byte[] input) {
signCalled.set(true);
assertEquals(QuicTestUtils.SELF_SIGNED_CERTIFICATE.cert().getPublicKey(),
engine.getSession().getLocalCertificates()[0].getPublicKey());
try {
if (fail) {
return ImmediateEventExecutor.INSTANCE.newFailedFuture(new SignatureException());
}
// Delegate signing to Java implementation.
final Signature signature;
// Depending on the Java version it will pick one or the other.
if (signatureAlgorithm == BoringSSLAsyncPrivateKeyMethod.SSL_SIGN_RSA_PKCS1_SHA256) {
signature = Signature.getInstance("SHA256withRSA");
} else if (signatureAlgorithm == BoringSSLAsyncPrivateKeyMethod.SSL_SIGN_RSA_PSS_RSAE_SHA256) {
signature = Signature.getInstance("RSASSA-PSS");
signature.setParameter(new PSSParameterSpec("SHA-256", "MGF1", MGF1ParameterSpec.SHA256,
32, 1));
} else {
throw new AssertionError("Unexpected signature algorithm " + signatureAlgorithm);
}
signature.initSign(QuicTestUtils.SELF_SIGNED_CERTIFICATE.key());
signature.update(input);
return ImmediateEventExecutor.INSTANCE.newSucceededFuture(signature.sign());
} catch (Throwable cause) {
return ImmediateEventExecutor.INSTANCE.newFailedFuture(cause);
}
}
@Override
public Future<byte[]> decrypt(SSLEngine engine, byte[] input) {
throw new UnsupportedOperationException();
}
};
BoringSSLKeylessManagerFactory factory = BoringSSLKeylessManagerFactory.newKeyless(
keyMethod, QuicTestUtils.SELF_SIGNED_CERTIFICATE.certificate());
Channel server = QuicTestUtils.newServer(QuicTestUtils.newQuicServerBuilder(executor,
QuicSslContextBuilder.forServer(factory, null)
.applicationProtocols(QuicTestUtils.PROTOS).clientAuth(ClientAuth.NONE).build()),
TestQuicTokenHandler.INSTANCE, new ChannelInboundHandlerAdapter() {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
causeRef.set(cause);
}
} ,
new ChannelInboundHandlerAdapter());
InetSocketAddress address = (InetSocketAddress) server.localAddress();
Channel channel = QuicTestUtils.newClient(QuicTestUtils.newQuicClientBuilder(executor,
QuicSslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.applicationProtocols(QuicTestUtils.PROTOS).build()));
try {
ChannelActiveVerifyHandler clientQuicChannelHandler = new ChannelActiveVerifyHandler();
Future<QuicChannel> connectFuture = QuicTestUtils.newQuicChannelBootstrap(channel)
.handler(clientQuicChannelHandler)
.streamHandler(new ChannelInboundHandlerAdapter())
.remoteAddress(address)
.connect().await();
if (fail) {
assertInstanceOf(ClosedChannelException.class, connectFuture.cause());
assertInstanceOf(SSLHandshakeException.class, causeRef.get());
} else {
QuicChannel quicChannel = connectFuture.get();
assertTrue(quicChannel.close().await().isSuccess());
ChannelFuture closeFuture = quicChannel.closeFuture().await();
assertTrue(closeFuture.isSuccess());
clientQuicChannelHandler.assertState();
assertNull(causeRef.get());
}
assertTrue(signCalled.get());
} finally {
server.close().sync();
// Close the parent Datagram channel as well.
Domain
Subdomains
Source
Frequently Asked Questions
What does testConnectKeyless0() do?
testConnectKeyless0() is a function in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java.
Where is testConnectKeyless0() defined?
testConnectKeyless0() is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicChannelConnectTest.java at line 1556.
What does testConnectKeyless0() call?
testConnectKeyless0() calls 2 function(s): assertState, exceptionCaught.
What calls testConnectKeyless0()?
testConnectKeyless0() is called by 2 function(s): testConnectKeyless, testConnectKeylessSignFailure.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free