Home / Function/ testHugeDecompress() — netty Function Reference

testHugeDecompress() — netty Function Reference

Architecture documentation for the testHugeDecompress() function in AbstractIntegrationTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  a45fc38f_6676_760b_39df_340c481d2b3c["testHugeDecompress()"]
  60eb60f4_51df_0542_7955_f04cb7b76df6["AbstractIntegrationTest"]
  a45fc38f_6676_760b_39df_340c481d2b3c -->|defined in| 60eb60f4_51df_0542_7955_f04cb7b76df6
  75c355fd_0bf1_2415_e932_0c42e579026a["HugeDecompressIncomingHandler()"]
  a45fc38f_6676_760b_39df_340c481d2b3c -->|calls| 75c355fd_0bf1_2415_e932_0c42e579026a
  style a45fc38f_6676_760b_39df_340c481d2b3c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-compression/src/test/java/io/netty/handler/codec/compression/AbstractIntegrationTest.java lines 191–234

    @Test
    @DisabledForSlowLeakDetection
    public void testHugeDecompress() throws Exception {
        int chunkSize = 1024 * 1024;
        int numberOfChunks = 256;
        int memoryLimit = chunkSize * 128;
        MessageDigest digest = MessageDigest.getInstance("SHA-256");

        EmbeddedChannel compressChannel = createEncoder();
        ByteBuf compressed = compressChannel.alloc().buffer();
        for (int i = 0; i <= numberOfChunks; i++) {
            if (i < numberOfChunks) {
                ByteBuf in = compressChannel.alloc().buffer(chunkSize);
                for (int j = 0; j < chunkSize; j++) {
                    byte byteValue = (byte) (i + (j & 0xA0));
                    in.writeByte(byteValue);
                    digest.update(byteValue);
                }
                compressChannel.writeOutbound(in);
            } else {
                compressChannel.close();
            }
            while (true) {
                ByteBuf buf = compressChannel.readOutbound();
                if (buf == null) {
                    break;
                }
                compressed.writeBytes(buf);
                buf.release();
            }
        }
        byte[] expectedData = digest.digest();

        PooledByteBufAllocator allocator = new PooledByteBufAllocator(false);

        HugeDecompressIncomingHandler endHandler = new HugeDecompressIncomingHandler(memoryLimit, digest);
        EmbeddedChannel decompressChannel = createDecoder();
        decompressChannel.pipeline().addLast(endHandler);
        decompressChannel.config().setAllocator(allocator);
        decompressChannel.writeInbound(compressed);
        decompressChannel.finishAndReleaseAll();
        assertEquals((long) chunkSize * numberOfChunks, endHandler.total);
        assertArrayEquals(expectedData, digest.digest());
    }

Domain

Subdomains

Frequently Asked Questions

What does testHugeDecompress() do?
testHugeDecompress() is a function in the netty codebase, defined in codec-compression/src/test/java/io/netty/handler/codec/compression/AbstractIntegrationTest.java.
Where is testHugeDecompress() defined?
testHugeDecompress() is defined in codec-compression/src/test/java/io/netty/handler/codec/compression/AbstractIntegrationTest.java at line 191.
What does testHugeDecompress() call?
testHugeDecompress() calls 1 function(s): HugeDecompressIncomingHandler.

Analyze Your Own Codebase

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

Try Supermodel Free