testBufferUnderFlow() — netty Function Reference
Architecture documentation for the testBufferUnderFlow() function in SSLEngineTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD a0eb415a_da1f_83c7_eeda_107186b3ba64["testBufferUnderFlow()"] 9150c92a_2afc_b83a_c3bf_86dfac6e9d9b["SSLEngineTest"] a0eb415a_da1f_83c7_eeda_107186b3ba64 -->|defined in| 9150c92a_2afc_b83a_c3bf_86dfac6e9d9b bf19737b_7dc7_9dfd_0a67_ae31448ebbe8["protocols()"] a0eb415a_da1f_83c7_eeda_107186b3ba64 -->|calls| bf19737b_7dc7_9dfd_0a67_ae31448ebbe8 e3b541e6_b593_4b1f_a637_da19020e73df["ciphers()"] a0eb415a_da1f_83c7_eeda_107186b3ba64 -->|calls| e3b541e6_b593_4b1f_a637_da19020e73df 7380f50e_d3f0_3078_ee65_de1cb780c79d["handshake()"] a0eb415a_da1f_83c7_eeda_107186b3ba64 -->|calls| 7380f50e_d3f0_3078_ee65_de1cb780c79d 13aca077_a788_4333_9f8b_2b1437653846["delegate()"] a0eb415a_da1f_83c7_eeda_107186b3ba64 -->|calls| 13aca077_a788_4333_9f8b_2b1437653846 0e09cce8_3105_2cf2_95ce_5844d1fecc61["assertResultIsBufferUnderflow()"] a0eb415a_da1f_83c7_eeda_107186b3ba64 -->|calls| 0e09cce8_3105_2cf2_95ce_5844d1fecc61 87e8e20d_ffbe_f5c3_4fd0_7d8ac419206d["cleanupClientSslEngine()"] a0eb415a_da1f_83c7_eeda_107186b3ba64 -->|calls| 87e8e20d_ffbe_f5c3_4fd0_7d8ac419206d 78ad5fe5_58d2_9877_f633_22a7048c0e5e["cleanupServerSslEngine()"] a0eb415a_da1f_83c7_eeda_107186b3ba64 -->|calls| 78ad5fe5_58d2_9877_f633_22a7048c0e5e style a0eb415a_da1f_83c7_eeda_107186b3ba64 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java lines 2901–2971
@MethodSource("newTestParams")
@ParameterizedTest
public void testBufferUnderFlow(SSLEngineTestParam param) throws Exception {
SelfSignedCertificate cert = CachedSelfSignedCertificate.getCachedCertificate();
clientSslCtx = wrapContext(param, SslContextBuilder
.forClient()
.trustManager(cert.cert())
.sslContextProvider(clientSslContextProvider())
.sslProvider(sslClientProvider())
.protocols(param.protocols())
.ciphers(param.ciphers())
.endpointIdentificationAlgorithm(null)
.build());
SSLEngine client = wrapEngine(clientSslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT));
serverSslCtx = wrapContext(param, SslContextBuilder
.forServer(cert.certificate(), cert.privateKey())
.sslContextProvider(serverSslContextProvider())
.sslProvider(sslServerProvider())
.protocols(param.protocols())
.ciphers(param.ciphers())
.build());
SSLEngine server = wrapEngine(serverSslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT));
try {
ByteBuffer plainClient = allocateBuffer(param.type(), 1024);
plainClient.limit(plainClient.capacity());
ByteBuffer encClientToServer = allocateBuffer(param.type(), client.getSession().getPacketBufferSize());
ByteBuffer plainServer = allocateBuffer(param.type(), server.getSession().getApplicationBufferSize());
handshake(param.type(), param.delegate(), client, server);
SSLEngineResult result = client.wrap(plainClient, encClientToServer);
assertEquals(SSLEngineResult.Status.OK, result.getStatus());
assertEquals(result.bytesConsumed(), plainClient.capacity());
// Flip so we can read it.
encClientToServer.flip();
int remaining = encClientToServer.remaining();
// We limit the buffer so we have less then the header to read, this should result in an BUFFER_UNDERFLOW.
encClientToServer.limit(SSL_RECORD_HEADER_LENGTH - 1);
result = server.unwrap(encClientToServer, plainServer);
assertResultIsBufferUnderflow(result);
// We limit the buffer so we can read the header but not the rest, this should result in an
// BUFFER_UNDERFLOW.
encClientToServer.limit(SSL_RECORD_HEADER_LENGTH);
result = server.unwrap(encClientToServer, plainServer);
assertResultIsBufferUnderflow(result);
// We limit the buffer so we can read the header and partly the rest, this should result in an
// BUFFER_UNDERFLOW.
encClientToServer.limit(SSL_RECORD_HEADER_LENGTH + remaining - 1 - SSL_RECORD_HEADER_LENGTH);
result = server.unwrap(encClientToServer, plainServer);
assertResultIsBufferUnderflow(result);
// Reset limit so we can read the full record.
encClientToServer.limit(remaining);
result = server.unwrap(encClientToServer, plainServer);
assertEquals(SSLEngineResult.Status.OK, result.getStatus());
assertEquals(result.bytesConsumed(), remaining);
assertTrue(result.bytesProduced() > 0);
} finally {
cleanupClientSslEngine(client);
cleanupServerSslEngine(server);
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does testBufferUnderFlow() do?
testBufferUnderFlow() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java.
Where is testBufferUnderFlow() defined?
testBufferUnderFlow() is defined in handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java at line 2901.
What does testBufferUnderFlow() call?
testBufferUnderFlow() calls 7 function(s): assertResultIsBufferUnderflow, ciphers, 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