testMultipleRecordsInOneBufferWithNonZeroPosition() — netty Function Reference
Architecture documentation for the testMultipleRecordsInOneBufferWithNonZeroPosition() function in SSLEngineTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 883adc08_0321_6bb9_506d_aed4d3605c60["testMultipleRecordsInOneBufferWithNonZeroPosition()"] 9150c92a_2afc_b83a_c3bf_86dfac6e9d9b["SSLEngineTest"] 883adc08_0321_6bb9_506d_aed4d3605c60 -->|defined in| 9150c92a_2afc_b83a_c3bf_86dfac6e9d9b bf19737b_7dc7_9dfd_0a67_ae31448ebbe8["protocols()"] 883adc08_0321_6bb9_506d_aed4d3605c60 -->|calls| bf19737b_7dc7_9dfd_0a67_ae31448ebbe8 e3b541e6_b593_4b1f_a637_da19020e73df["ciphers()"] 883adc08_0321_6bb9_506d_aed4d3605c60 -->|calls| e3b541e6_b593_4b1f_a637_da19020e73df 7380f50e_d3f0_3078_ee65_de1cb780c79d["handshake()"] 883adc08_0321_6bb9_506d_aed4d3605c60 -->|calls| 7380f50e_d3f0_3078_ee65_de1cb780c79d 13aca077_a788_4333_9f8b_2b1437653846["delegate()"] 883adc08_0321_6bb9_506d_aed4d3605c60 -->|calls| 13aca077_a788_4333_9f8b_2b1437653846 87e8e20d_ffbe_f5c3_4fd0_7d8ac419206d["cleanupClientSslEngine()"] 883adc08_0321_6bb9_506d_aed4d3605c60 -->|calls| 87e8e20d_ffbe_f5c3_4fd0_7d8ac419206d 78ad5fe5_58d2_9877_f633_22a7048c0e5e["cleanupServerSslEngine()"] 883adc08_0321_6bb9_506d_aed4d3605c60 -->|calls| 78ad5fe5_58d2_9877_f633_22a7048c0e5e style 883adc08_0321_6bb9_506d_aed4d3605c60 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java lines 2748–2828
@MethodSource("newTestParams")
@ParameterizedTest
public void testMultipleRecordsInOneBufferWithNonZeroPosition(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 {
// Choose buffer size small enough that we can put multiple buffers into one buffer and pass it into the
// unwrap call without exceed MAX_ENCRYPTED_PACKET_LENGTH.
ByteBuffer plainClientOut = allocateBuffer(param.type(), 1024);
ByteBuffer plainServerOut = allocateBuffer(param.type(), server.getSession().getApplicationBufferSize());
ByteBuffer encClientToServer = allocateBuffer(param.type(), client.getSession().getPacketBufferSize());
int positionOffset = 1;
// We need to be able to hold 2 records + positionOffset
ByteBuffer combinedEncClientToServer = allocateBuffer(
param.type(), encClientToServer.capacity() * 2 + positionOffset);
combinedEncClientToServer.position(positionOffset);
handshake(param.type(), param.delegate(), client, server);
plainClientOut.limit(plainClientOut.capacity());
SSLEngineResult result = client.wrap(plainClientOut, encClientToServer);
assertEquals(plainClientOut.capacity(), result.bytesConsumed());
assertTrue(result.bytesProduced() > 0);
encClientToServer.flip();
// Copy the first record into the combined buffer
combinedEncClientToServer.put(encClientToServer);
plainClientOut.clear();
encClientToServer.clear();
result = client.wrap(plainClientOut, encClientToServer);
assertEquals(plainClientOut.capacity(), result.bytesConsumed());
assertTrue(result.bytesProduced() > 0);
encClientToServer.flip();
int encClientToServerLen = encClientToServer.remaining();
// Copy the first record into the combined buffer
combinedEncClientToServer.put(encClientToServer);
encClientToServer.clear();
combinedEncClientToServer.flip();
combinedEncClientToServer.position(positionOffset);
// Ensure we have the first record and a tiny amount of the second record in the buffer
combinedEncClientToServer.limit(
combinedEncClientToServer.limit() - (encClientToServerLen - positionOffset));
result = server.unwrap(combinedEncClientToServer, plainServerOut);
assertEquals(encClientToServerLen, result.bytesConsumed());
assertTrue(result.bytesProduced() > 0);
} finally {
cleanupClientSslEngine(client);
cleanupServerSslEngine(server);
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testMultipleRecordsInOneBufferWithNonZeroPosition() do?
testMultipleRecordsInOneBufferWithNonZeroPosition() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java.
Where is testMultipleRecordsInOneBufferWithNonZeroPosition() defined?
testMultipleRecordsInOneBufferWithNonZeroPosition() is defined in handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java at line 2748.
What does testMultipleRecordsInOneBufferWithNonZeroPosition() call?
testMultipleRecordsInOneBufferWithNonZeroPosition() calls 6 function(s): 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