@Override
    protected int rsv(WebSocketFrame msg) {
        return msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame?
                msg.rsv() | WebSocketExtension.RSV1 : msg.rsv();
    }
@Test
    public void testSelectivityCompressionSkip() {
        WebSocketExtensionFilter selectivityCompressionFilter = new WebSocketExtensionFilter() {
            @Override
            public boolean mustSkip(WebSocketFrame frame) {
                return  (frame instanceof TextWebSocketFrame || frame instanceof BinaryWebSocketFrame)
                    && frame.content().readableBytes() < 100;
            }
        };
        EmbeddedChannel encoderChannel = new EmbeddedChannel(
                new PerMessageDeflateEncoder(9, 15, false, selectivityCompressionFilter));
        EmbeddedChannel decoderChannel = new EmbeddedChannel(
                ZlibCodecFactory.newZlibDecoder(ZlibWrapper.NONE));

        String textPayload = "not compressed payload";
        byte[] binaryPayload = new byte[101];
        random.nextBytes(binaryPayload);

        WebSocketFrame textFrame = new TextWebSocketFrame(textPayload);
        BinaryWebSocketFrame binaryFrame = new BinaryWebSocketFrame(Unpooled.wrappedBuffer(binaryPayload));

        assertTrue(encoderChannel.writeOutbound(textFrame));
        assertTrue(encoderChannel.writeOutbound(binaryFrame));

        WebSocketFrame outboundTextFrame = encoderChannel.readOutbound();

        //compression skipped for textFrame
        assertEquals(0, outboundTextFrame.rsv());
        assertEquals(textPayload, outboundTextFrame.content().toString(UTF_8));
        assertTrue(outboundTextFrame.release());

        WebSocketFrame outboundBinaryFrame = encoderChannel.readOutbound();

        //compression not skipped for binaryFrame
        assertEquals(WebSocketExtension.RSV1, outboundBinaryFrame.rsv());

        assertTrue(decoderChannel.writeInbound(outboundBinaryFrame.content().retain()));
        ByteBuf uncompressedBinaryPayload = decoderChannel.readInbound();

        assertArrayEquals(binaryPayload, ByteBufUtil.getBytes(uncompressedBinaryPayload));

        assertTrue(outboundBinaryFrame.release());
        assertTrue(uncompressedBinaryPayload.release());

        assertFalse(encoderChannel.finish());
        assertFalse(decoderChannel.finish());
    }