Package io.netty.handler.codec.http.websocketx

Examples of io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame.content()


    @Override
    protected void decode(final ChannelHandlerContext channelHandlerContext, final WebSocketFrame webSocketFrame, final List<Object> objects) throws Exception {
        try {
            if (webSocketFrame instanceof BinaryWebSocketFrame) {
                final BinaryWebSocketFrame tf = (BinaryWebSocketFrame) webSocketFrame;
                objects.add(serializer.deserializeResponse(tf.content()));
            } else {
                final TextWebSocketFrame tf = (TextWebSocketFrame) webSocketFrame;
                final MessageTextSerializer textSerializer = (MessageTextSerializer) serializer;
                objects.add(textSerializer.deserializeResponse(tf.text()));
            }
View Full Code Here


        encoderChannel.writeOutbound(frame);
        BinaryWebSocketFrame compressedFrame = encoderChannel.readOutbound();

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

        decoderChannel.writeInbound(compressedFrame.content());
        decoderChannel.writeInbound(DeflateDecoder.FRAME_TAIL);
View Full Code Here

        assertNotNull(compressedFrame);
        assertNotNull(compressedFrame.content());
        assertTrue(compressedFrame instanceof BinaryWebSocketFrame);
        assertEquals(WebSocketExtension.RSV1 | WebSocketExtension.RSV3, compressedFrame.rsv());

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

        byte[] finalPayload = new byte[300];
View Full Code Here

        encoderChannel.writeOutbound(frame);
        BinaryWebSocketFrame newFrame = encoderChannel.readOutbound();

        // test
        assertNotNull(newFrame);
        assertNotNull(newFrame.content());
        assertTrue(newFrame instanceof BinaryWebSocketFrame);
        assertEquals(WebSocketExtension.RSV3 | WebSocketExtension.RSV1, newFrame.rsv());
        assertEquals(300, newFrame.content().readableBytes());

        byte[] finalPayload = new byte[300];
View Full Code Here

        // test
        assertNotNull(newFrame);
        assertNotNull(newFrame.content());
        assertTrue(newFrame instanceof BinaryWebSocketFrame);
        assertEquals(WebSocketExtension.RSV3 | WebSocketExtension.RSV1, newFrame.rsv());
        assertEquals(300, newFrame.content().readableBytes());

        byte[] finalPayload = new byte[300];
        newFrame.content().readBytes(finalPayload);
        assertTrue(Arrays.equals(finalPayload, payload));
        newFrame.release();
View Full Code Here

        assertTrue(newFrame instanceof BinaryWebSocketFrame);
        assertEquals(WebSocketExtension.RSV3 | WebSocketExtension.RSV1, newFrame.rsv());
        assertEquals(300, newFrame.content().readableBytes());

        byte[] finalPayload = new byte[300];
        newFrame.content().readBytes(finalPayload);
        assertTrue(Arrays.equals(finalPayload, payload));
        newFrame.release();
    }

    @Test
View Full Code Here

        assertEquals(WebSocketExtension.RSV1 | WebSocketExtension.RSV3, compressedFrame3.rsv());
        assertFalse(compressedFrame1.isFinalFragment());
        assertFalse(compressedFrame2.isFinalFragment());
        assertTrue(compressedFrame3.isFinalFragment());

        decoderChannel.writeInbound(compressedFrame1.content());
        decoderChannel.writeInbound(Unpooled.wrappedBuffer(DeflateDecoder.FRAME_TAIL));
        ByteBuf uncompressedPayload1 = decoderChannel.readInbound();
        byte[] finalPayload1 = new byte[100];
        uncompressedPayload1.readBytes(finalPayload1);
        assertTrue(Arrays.equals(finalPayload1, payload1));
View Full Code Here

        decoderChannel.writeInbound(compressedFrame);
        BinaryWebSocketFrame uncompressedFrame = decoderChannel.readInbound();

        // test
        assertNotNull(uncompressedFrame);
        assertNotNull(uncompressedFrame.content());
        assertTrue(uncompressedFrame instanceof BinaryWebSocketFrame);
        assertEquals(WebSocketExtension.RSV3, uncompressedFrame.rsv());
        assertEquals(300, uncompressedFrame.content().readableBytes());

        byte[] finalPayload = new byte[300];
View Full Code Here

        // test
        assertNotNull(uncompressedFrame);
        assertNotNull(uncompressedFrame.content());
        assertTrue(uncompressedFrame instanceof BinaryWebSocketFrame);
        assertEquals(WebSocketExtension.RSV3, uncompressedFrame.rsv());
        assertEquals(300, uncompressedFrame.content().readableBytes());

        byte[] finalPayload = new byte[300];
        uncompressedFrame.content().readBytes(finalPayload);
        assertTrue(Arrays.equals(finalPayload, payload));
        uncompressedFrame.release();
View Full Code Here

        assertTrue(uncompressedFrame instanceof BinaryWebSocketFrame);
        assertEquals(WebSocketExtension.RSV3, uncompressedFrame.rsv());
        assertEquals(300, uncompressedFrame.content().readableBytes());

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

    @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.