testSSLSessionId() — netty Function Reference
Architecture documentation for the testSSLSessionId() function in SSLEngineTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 5375e3e4_ce21_a9c7_f00f_e17068b8f5dd["testSSLSessionId()"] 9150c92a_2afc_b83a_c3bf_86dfac6e9d9b["SSLEngineTest"] 5375e3e4_ce21_a9c7_f00f_e17068b8f5dd -->|defined in| 9150c92a_2afc_b83a_c3bf_86dfac6e9d9b bf19737b_7dc7_9dfd_0a67_ae31448ebbe8["protocols()"] 5375e3e4_ce21_a9c7_f00f_e17068b8f5dd -->|calls| bf19737b_7dc7_9dfd_0a67_ae31448ebbe8 7380f50e_d3f0_3078_ee65_de1cb780c79d["handshake()"] 5375e3e4_ce21_a9c7_f00f_e17068b8f5dd -->|calls| 7380f50e_d3f0_3078_ee65_de1cb780c79d 13aca077_a788_4333_9f8b_2b1437653846["delegate()"] 5375e3e4_ce21_a9c7_f00f_e17068b8f5dd -->|calls| 13aca077_a788_4333_9f8b_2b1437653846 87e8e20d_ffbe_f5c3_4fd0_7d8ac419206d["cleanupClientSslEngine()"] 5375e3e4_ce21_a9c7_f00f_e17068b8f5dd -->|calls| 87e8e20d_ffbe_f5c3_4fd0_7d8ac419206d 78ad5fe5_58d2_9877_f633_22a7048c0e5e["cleanupServerSslEngine()"] 5375e3e4_ce21_a9c7_f00f_e17068b8f5dd -->|calls| 78ad5fe5_58d2_9877_f633_22a7048c0e5e style 5375e3e4_ce21_a9c7_f00f_e17068b8f5dd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java lines 1400–1483
@MethodSource("newTestParams")
@ParameterizedTest
public void testSSLSessionId(SSLEngineTestParam param) throws Exception {
clientSslCtx = wrapContext(param, SslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.sslProvider(sslClientProvider())
// This test only works for non TLSv1.3 for now
.protocols(param.protocols())
.sslContextProvider(clientSslContextProvider())
.build());
SelfSignedCertificate ssc = CachedSelfSignedCertificate.getCachedCertificate();
serverSslCtx = wrapContext(param, SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey())
.sslProvider(sslServerProvider())
// This test only works for non TLSv1.3 for now
.protocols(param.protocols())
.sslContextProvider(serverSslContextProvider())
.build());
SSLEngine clientEngine = null;
SSLEngine serverEngine = null;
try {
clientEngine = wrapEngine(clientSslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT));
serverEngine = wrapEngine(serverSslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT));
// Before the handshake the id should have length == 0
assertEquals(0, clientEngine.getSession().getId().length);
assertEquals(0, serverEngine.getSession().getId().length);
handshake(param.type(), param.delegate(), clientEngine, serverEngine);
if (param.protocolCipherCombo == ProtocolCipherCombo.TLSV13) {
// Allocate something which is big enough for sure
ByteBuffer packetBuffer = allocateBuffer(param.type(), 32 * 1024);
ByteBuffer appBuffer = allocateBuffer(param.type(), 32 * 1024);
appBuffer.clear().position(4).flip();
packetBuffer.clear();
do {
SSLEngineResult result;
do {
result = serverEngine.wrap(appBuffer, packetBuffer);
} while (appBuffer.hasRemaining() || result.bytesProduced() > 0);
appBuffer.clear();
packetBuffer.flip();
do {
result = clientEngine.unwrap(packetBuffer, appBuffer);
} while (packetBuffer.hasRemaining() || result.bytesProduced() > 0);
packetBuffer.clear();
appBuffer.clear().position(4).flip();
do {
result = clientEngine.wrap(appBuffer, packetBuffer);
} while (appBuffer.hasRemaining() || result.bytesProduced() > 0);
appBuffer.clear();
packetBuffer.flip();
do {
result = serverEngine.unwrap(packetBuffer, appBuffer);
} while (packetBuffer.hasRemaining() || result.bytesProduced() > 0);
packetBuffer.clear();
appBuffer.clear().position(4).flip();
} while (clientEngine.getSession().getId().length == 0);
// With TLS1.3 we should see pseudo IDs and so these should never match.
assertFalse(Arrays.equals(clientEngine.getSession().getId(), serverEngine.getSession().getId()));
} else if (OpenSslEngineTestParam.isUsingTickets(param)) {
// After the handshake the client should have ticket ids
assertNotEquals(0, clientEngine.getSession().getId().length);
} else {
// After the handshake the id should have length > 0
assertNotEquals(0, clientEngine.getSession().getId().length);
assertNotEquals(0, serverEngine.getSession().getId().length);
assertArrayEquals(clientEngine.getSession().getId(), serverEngine.getSession().getId());
}
} finally {
cleanupClientSslEngine(clientEngine);
Domain
Subdomains
Source
Frequently Asked Questions
What does testSSLSessionId() do?
testSSLSessionId() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java.
Where is testSSLSessionId() defined?
testSSLSessionId() is defined in handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java at line 1400.
What does testSSLSessionId() call?
testSSLSessionId() calls 5 function(s): cleanupClientSslEngine, cleanupServerSslEngine, delegate, handshake, protocols.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free