Home / Function/ testCompressedFrame() — netty Function Reference

testCompressedFrame() — netty Function Reference

Architecture documentation for the testCompressedFrame() function in PerFrameDeflateDecoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  83c8a9a5_7456_4c52_0828_080d887652a5["testCompressedFrame()"]
  758acdb4_a05e_36ff_8910_74b681e91da1["PerFrameDeflateDecoderTest"]
  83c8a9a5_7456_4c52_0828_080d887652a5 -->|defined in| 758acdb4_a05e_36ff_8910_74b681e91da1
  style 83c8a9a5_7456_4c52_0828_080d887652a5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/websocketx/extensions/compression/PerFrameDeflateDecoderTest.java lines 41–72

    @Test
    public void testCompressedFrame() {
        EmbeddedChannel encoderChannel = new EmbeddedChannel(
                ZlibCodecFactory.newZlibEncoder(ZlibWrapper.NONE, 9, 15, 8));
        EmbeddedChannel decoderChannel = new EmbeddedChannel(new PerFrameDeflateDecoder(false, 0));

        // initialize
        byte[] payload = new byte[300];
        random.nextBytes(payload);

        assertTrue(encoderChannel.writeOutbound(Unpooled.wrappedBuffer(payload)));
        ByteBuf compressedPayload = encoderChannel.readOutbound();

        BinaryWebSocketFrame compressedFrame = new BinaryWebSocketFrame(true,
                RSV1 | RSV3,
                compressedPayload.slice(0, compressedPayload.readableBytes() - 4));

        // execute
        assertTrue(decoderChannel.writeInbound(compressedFrame));
        BinaryWebSocketFrame uncompressedFrame = decoderChannel.readInbound();

        // test
        assertNotNull(uncompressedFrame);
        assertNotNull(uncompressedFrame.content());
        assertEquals(RSV3, uncompressedFrame.rsv());
        assertEquals(300, uncompressedFrame.content().readableBytes());

        byte[] finalPayload = new byte[300];
        uncompressedFrame.content().readBytes(finalPayload);
        assertArrayEquals(finalPayload, payload);
        uncompressedFrame.release();
    }

Domain

Subdomains

Frequently Asked Questions

What does testCompressedFrame() do?
testCompressedFrame() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/extensions/compression/PerFrameDeflateDecoderTest.java.
Where is testCompressedFrame() defined?
testCompressedFrame() is defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/extensions/compression/PerFrameDeflateDecoderTest.java at line 41.

Analyze Your Own Codebase

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

Try Supermodel Free