testIllegalStateWhenDecompressionInProgress() — netty Function Reference
Architecture documentation for the testIllegalStateWhenDecompressionInProgress() function in PerMessageDeflateDecoderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 5d11d05d_0935_472f_e884_2981351d6f30["testIllegalStateWhenDecompressionInProgress()"] 5fb9cabd_f848_d24f_11ed_16ea8470984d["PerMessageDeflateDecoderTest"] 5d11d05d_0935_472f_e884_2981351d6f30 -->|defined in| 5fb9cabd_f848_d24f_11ed_16ea8470984d style 5d11d05d_0935_472f_e884_2981351d6f30 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 273–323
@Test
public void testIllegalStateWhenDecompressionInProgress() {
WebSocketExtensionFilter selectivityDecompressionFilter = new WebSocketExtensionFilter() {
@Override
public boolean mustSkip(WebSocketFrame frame) {
return frame.content().readableBytes() < 100;
}
};
EmbeddedChannel encoderChannel = new EmbeddedChannel(
ZlibCodecFactory.newZlibEncoder(ZlibWrapper.NONE, 9, 15, 8));
final EmbeddedChannel decoderChannel = new EmbeddedChannel(
new PerMessageDeflateDecoder(false, selectivityDecompressionFilter, 0));
byte[] firstPayload = new byte[200];
random.nextBytes(firstPayload);
byte[] finalPayload = new byte[50];
random.nextBytes(finalPayload);
assertTrue(encoderChannel.writeOutbound(Unpooled.wrappedBuffer(firstPayload)));
assertTrue(encoderChannel.writeOutbound(Unpooled.wrappedBuffer(finalPayload)));
ByteBuf compressedFirstPayload = encoderChannel.readOutbound();
ByteBuf compressedFinalPayload = encoderChannel.readOutbound();
assertTrue(encoderChannel.finishAndReleaseAll());
BinaryWebSocketFrame firstPart = new BinaryWebSocketFrame(false, WebSocketExtension.RSV1,
compressedFirstPayload);
final ContinuationWebSocketFrame finalPart = new ContinuationWebSocketFrame(true, WebSocketExtension.RSV1,
compressedFinalPayload);
assertTrue(decoderChannel.writeInbound(firstPart));
BinaryWebSocketFrame outboundFirstPart = decoderChannel.readInbound();
//first part is decompressed
assertEquals(0, outboundFirstPart.rsv());
assertArrayEquals(firstPayload, ByteBufUtil.getBytes(outboundFirstPart.content()));
assertTrue(outboundFirstPart.release());
//final part throwing exception
try {
assertThrows(DecoderException.class, new Executable() {
@Override
public void execute() {
decoderChannel.writeInbound(finalPart);
}
});
} finally {
assertTrue(finalPart.release());
assertFalse(encoderChannel.finishAndReleaseAll());
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testIllegalStateWhenDecompressionInProgress() do?
testIllegalStateWhenDecompressionInProgress() 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 testIllegalStateWhenDecompressionInProgress() defined?
testIllegalStateWhenDecompressionInProgress() is defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/extensions/compression/PerMessageDeflateDecoderTest.java at line 273.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free