Home / Function/ testCompressedFrame() — netty Function Reference

testCompressedFrame() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  ef7540ee_02af_6bfa_a49d_ca2b38963970["testCompressedFrame()"]
  74922fa4_3ca7_d958_57dc_fafad72e442c["PerMessageDeflateEncoderTest"]
  ef7540ee_02af_6bfa_a49d_ca2b38963970 -->|defined in| 74922fa4_3ca7_d958_57dc_fafad72e442c
  style ef7540ee_02af_6bfa_a49d_ca2b38963970 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/websocketx/extensions/compression/PerMessageDeflateEncoderTest.java lines 51–81

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

        // initialize
        byte[] payload = new byte[300];
        random.nextBytes(payload);
        BinaryWebSocketFrame frame = new BinaryWebSocketFrame(true,
                                                              WebSocketExtension.RSV3, Unpooled.wrappedBuffer(payload));

        // execute
        assertTrue(encoderChannel.writeOutbound(frame));
        BinaryWebSocketFrame compressedFrame = encoderChannel.readOutbound();

        // test
        assertNotNull(compressedFrame);
        assertNotNull(compressedFrame.content());
        assertEquals(WebSocketExtension.RSV1 | WebSocketExtension.RSV3, compressedFrame.rsv());

        assertTrue(decoderChannel.writeInbound(compressedFrame.content()));
        assertTrue(decoderChannel.writeInbound(DeflateDecoder.FRAME_TAIL.duplicate()));
        ByteBuf uncompressedPayload = decoderChannel.readInbound();
        assertEquals(300, uncompressedPayload.readableBytes());

        byte[] finalPayload = new byte[300];
        uncompressedPayload.readBytes(finalPayload);
        assertArrayEquals(finalPayload, payload);
        uncompressedPayload.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/PerMessageDeflateEncoderTest.java.
Where is testCompressedFrame() defined?
testCompressedFrame() is defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/extensions/compression/PerMessageDeflateEncoderTest.java at line 51.

Analyze Your Own Codebase

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

Try Supermodel Free