testMultipleRecordsInOneBufferWithNonZeroPositionJDKCompatabilityModeOff() — netty Function Reference
Architecture documentation for the testMultipleRecordsInOneBufferWithNonZeroPositionJDKCompatabilityModeOff() function in OpenSslEngineTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD d52d3ec3_e0b5_c5ee_5650_6be7be7ceb7c["testMultipleRecordsInOneBufferWithNonZeroPositionJDKCompatabilityModeOff()"] 08957e63_66e1_e2b4_c8aa_4f617c598a7d["OpenSslEngineTest"] d52d3ec3_e0b5_c5ee_5650_6be7be7ceb7c -->|defined in| 08957e63_66e1_e2b4_c8aa_4f617c598a7d style d52d3ec3_e0b5_c5ee_5650_6be7be7ceb7c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
handler/src/test/java/io/netty/handler/ssl/OpenSslEngineTest.java lines 694–775
@MethodSource("newTestParams")
@ParameterizedTest
public void testMultipleRecordsInOneBufferWithNonZeroPositionJDKCompatabilityModeOff(SSLEngineTestParam param)
throws Exception {
SelfSignedCertificate cert = CachedSelfSignedCertificate.getCachedCertificate();
clientSslCtx = wrapContext(param, SslContextBuilder
.forClient()
.trustManager(cert.cert())
.sslProvider(sslClientProvider())
.protocols(param.protocols())
.ciphers(param.ciphers())
.endpointIdentificationAlgorithm(null)
.build());
SSLEngine client = wrapEngine(clientSslCtx.newHandler(UnpooledByteBufAllocator.DEFAULT).engine());
serverSslCtx = wrapContext(param, SslContextBuilder
.forServer(cert.certificate(), cert.privateKey())
.sslProvider(sslServerProvider())
.protocols(param.protocols())
.ciphers(param.ciphers())
.build());
SSLEngine server = wrapEngine(serverSslCtx.newHandler(UnpooledByteBufAllocator.DEFAULT).engine());
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.
final int plainClientOutLen = 1024;
ByteBuffer plainClientOut = allocateBuffer(param.type(), plainClientOutLen);
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();
// Copy the first record into the combined buffer
combinedEncClientToServer.put(encClientToServer);
encClientToServer.clear();
combinedEncClientToServer.flip();
combinedEncClientToServer.position(positionOffset);
// Make sure the limit takes positionOffset into account to the content we are looking at is correct.
combinedEncClientToServer.limit(
combinedEncClientToServer.limit() - positionOffset);
final int combinedEncClientToServerLen = combinedEncClientToServer.remaining();
result = server.unwrap(combinedEncClientToServer, plainServerOut);
assertEquals(0, combinedEncClientToServer.remaining());
assertEquals(combinedEncClientToServerLen, result.bytesConsumed());
assertEquals(plainClientOutLen, result.bytesProduced());
} finally {
cleanupClientSslEngine(client);
cleanupServerSslEngine(server);
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testMultipleRecordsInOneBufferWithNonZeroPositionJDKCompatabilityModeOff() do?
testMultipleRecordsInOneBufferWithNonZeroPositionJDKCompatabilityModeOff() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/OpenSslEngineTest.java.
Where is testMultipleRecordsInOneBufferWithNonZeroPositionJDKCompatabilityModeOff() defined?
testMultipleRecordsInOneBufferWithNonZeroPositionJDKCompatabilityModeOff() is defined in handler/src/test/java/io/netty/handler/ssl/OpenSslEngineTest.java at line 694.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free