Home / Function/ testSrcsLenOverFlowCorrectlyHandled() — netty Function Reference

testSrcsLenOverFlowCorrectlyHandled() — netty Function Reference

Architecture documentation for the testSrcsLenOverFlowCorrectlyHandled() function in OpenSslEngineTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  949b526c_a1e3_768d_3714_fe2b64c8627d["testSrcsLenOverFlowCorrectlyHandled()"]
  08957e63_66e1_e2b4_c8aa_4f617c598a7d["OpenSslEngineTest"]
  949b526c_a1e3_768d_3714_fe2b64c8627d -->|defined in| 08957e63_66e1_e2b4_c8aa_4f617c598a7d
  style 949b526c_a1e3_768d_3714_fe2b64c8627d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/OpenSslEngineTest.java lines 388–438

    @MethodSource("newTestParams")
    @ParameterizedTest
    public void testSrcsLenOverFlowCorrectlyHandled(SSLEngineTestParam param) throws Exception {
        clientSslCtx = wrapContext(param, SslContextBuilder.forClient()
                                        .trustManager(InsecureTrustManagerFactory.INSTANCE)
                                        .sslProvider(sslClientProvider())
                                        .protocols(param.protocols())
                                        .ciphers(param.ciphers())
                                        .build());
        SelfSignedCertificate ssc = CachedSelfSignedCertificate.getCachedCertificate();
        serverSslCtx = wrapContext(param, SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey())
                                        .sslProvider(sslServerProvider())
                                        .protocols(param.protocols())
                                        .ciphers(param.ciphers())
                                        .build());
        SSLEngine clientEngine = null;
        SSLEngine serverEngine = null;
        try {
            clientEngine = wrapEngine(clientSslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT));
            serverEngine = wrapEngine(serverSslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT));
            handshake(param.type(), param.delegate(), clientEngine, serverEngine);

            ByteBuffer src = allocateBuffer(param.type(), 1024);
            List<ByteBuffer> srcList = new ArrayList<ByteBuffer>();
            long srcsLen = 0;
            long maxLen = ((long) MAX_VALUE) * 2;

            while (srcsLen < maxLen) {
                ByteBuffer dup = src.duplicate();
                srcList.add(dup);
                srcsLen += dup.capacity();
            }

            ByteBuffer[] srcs = srcList.toArray(new ByteBuffer[0]);
            ByteBuffer dst = allocateBuffer(
                    param.type(), unwrapEngine(clientEngine).maxEncryptedPacketLength() - 1);

            SSLEngineResult result = clientEngine.wrap(srcs, dst);
            assertEquals(SSLEngineResult.Status.BUFFER_OVERFLOW, result.getStatus());

            for (ByteBuffer buffer : srcs) {
                assertEquals(0, buffer.position());
            }
            assertEquals(0, dst.position());
            assertEquals(0, result.bytesConsumed());
            assertEquals(0, result.bytesProduced());
        } finally {
            cleanupClientSslEngine(clientEngine);
            cleanupServerSslEngine(serverEngine);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testSrcsLenOverFlowCorrectlyHandled() do?
testSrcsLenOverFlowCorrectlyHandled() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/OpenSslEngineTest.java.
Where is testSrcsLenOverFlowCorrectlyHandled() defined?
testSrcsLenOverFlowCorrectlyHandled() is defined in handler/src/test/java/io/netty/handler/ssl/OpenSslEngineTest.java at line 388.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free