Home / Function/ testCompressedFrame() — netty Function Reference

testCompressedFrame() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e1fea6b4_2fa8_38a1_fc94_f63e36ddf687["testCompressedFrame()"]
  5fb9cabd_f848_d24f_11ed_16ea8470984d["PerMessageDeflateDecoderTest"]
  e1fea6b4_2fa8_38a1_fc94_f63e36ddf687 -->|defined in| 5fb9cabd_f848_d24f_11ed_16ea8470984d
  style e1fea6b4_2fa8_38a1_fc94_f63e36ddf687 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

    @Test
    public void testCompressedFrame() {
        EmbeddedChannel encoderChannel = new EmbeddedChannel(
                ZlibCodecFactory.newZlibEncoder(ZlibWrapper.NONE, 9, 15, 8));
        EmbeddedChannel decoderChannel = new EmbeddedChannel(new PerMessageDeflateDecoder(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,
                WebSocketExtension.RSV1 | WebSocketExtension.RSV3,
                compressedPayload.slice(0, compressedPayload.readableBytes() - 4));

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

        // test
        assertNotNull(uncompressedFrame);
        assertNotNull(uncompressedFrame.content());
        assertEquals(WebSocketExtension.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/PerMessageDeflateDecoderTest.java.
Where is testCompressedFrame() defined?
testCompressedFrame() is defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/extensions/compression/PerMessageDeflateDecoderTest.java at line 50.

Analyze Your Own Codebase

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

Try Supermodel Free