WebSocketFrameAggregatorTest Class — netty Architecture
Architecture documentation for the WebSocketFrameAggregatorTest class in WebSocketFrameAggregatorTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 9b5f26dc_7e92_130b_ab49_c6ef440312f1["WebSocketFrameAggregatorTest"] 0c4f55f9_e953_be32_0142_da5ff456ecda["WebSocketFrameAggregatorTest.java"] 9b5f26dc_7e92_130b_ab49_c6ef440312f1 -->|defined in| 0c4f55f9_e953_be32_0142_da5ff456ecda b7764254_fa18_8965_3b32_9b8b5095eec5["testAggregationBinary()"] 9b5f26dc_7e92_130b_ab49_c6ef440312f1 -->|method| b7764254_fa18_8965_3b32_9b8b5095eec5 da3c791b_14b0_0a1f_c47b_cb0bff73fa66["testAggregationText()"] 9b5f26dc_7e92_130b_ab49_c6ef440312f1 -->|method| da3c791b_14b0_0a1f_c47b_cb0bff73fa66 151f8d9b_12c6_298e_1f79_8715d8d8134e["textFrameTooBig()"] 9b5f26dc_7e92_130b_ab49_c6ef440312f1 -->|method| 151f8d9b_12c6_298e_1f79_8715d8d8134e 9aa64dd6_6e63_3fd7_0944_7e6183dc48f2["toBytes()"] 9b5f26dc_7e92_130b_ab49_c6ef440312f1 -->|method| 9aa64dd6_6e63_3fd7_0944_7e6183dc48f2
Relationship Graph
Source Code
codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketFrameAggregatorTest.java lines 33–154
public class WebSocketFrameAggregatorTest {
private static final byte[] content1 = "Content1".getBytes(CharsetUtil.UTF_8);
private static final byte[] content2 = "Content2".getBytes(CharsetUtil.UTF_8);
private static final byte[] content3 = "Content3".getBytes(CharsetUtil.UTF_8);
private static final byte[] aggregatedContent = new byte[content1.length + content2.length + content3.length];
static {
System.arraycopy(content1, 0, aggregatedContent, 0, content1.length);
System.arraycopy(content2, 0, aggregatedContent, content1.length, content2.length);
System.arraycopy(content3, 0, aggregatedContent, content1.length + content2.length, content3.length);
}
@Test
public void testAggregationBinary() {
EmbeddedChannel channel = new EmbeddedChannel(new WebSocketFrameAggregator(Integer.MAX_VALUE));
channel.writeInbound(new BinaryWebSocketFrame(true, 1, Unpooled.wrappedBuffer(content1)));
channel.writeInbound(new BinaryWebSocketFrame(false, 0, Unpooled.wrappedBuffer(content1)));
channel.writeInbound(new ContinuationWebSocketFrame(false, 0, Unpooled.wrappedBuffer(content2)));
channel.writeInbound(new PingWebSocketFrame(Unpooled.wrappedBuffer(content1)));
channel.writeInbound(new PongWebSocketFrame(Unpooled.wrappedBuffer(content1)));
channel.writeInbound(new ContinuationWebSocketFrame(true, 0, Unpooled.wrappedBuffer(content3)));
assertTrue(channel.finish());
BinaryWebSocketFrame frame = channel.readInbound();
assertTrue(frame.isFinalFragment());
assertEquals(1, frame.rsv());
assertArrayEquals(content1, toBytes(frame.content()));
PingWebSocketFrame frame2 = channel.readInbound();
assertTrue(frame2.isFinalFragment());
assertEquals(0, frame2.rsv());
assertArrayEquals(content1, toBytes(frame2.content()));
PongWebSocketFrame frame3 = channel.readInbound();
assertTrue(frame3.isFinalFragment());
assertEquals(0, frame3.rsv());
assertArrayEquals(content1, toBytes(frame3.content()));
BinaryWebSocketFrame frame4 = channel.readInbound();
assertTrue(frame4.isFinalFragment());
assertEquals(0, frame4.rsv());
assertArrayEquals(aggregatedContent, toBytes(frame4.content()));
assertNull(channel.readInbound());
}
@Test
public void testAggregationText() {
EmbeddedChannel channel = new EmbeddedChannel(new WebSocketFrameAggregator(Integer.MAX_VALUE));
channel.writeInbound(new TextWebSocketFrame(true, 1, Unpooled.wrappedBuffer(content1)));
channel.writeInbound(new TextWebSocketFrame(false, 0, Unpooled.wrappedBuffer(content1)));
channel.writeInbound(new ContinuationWebSocketFrame(false, 0, Unpooled.wrappedBuffer(content2)));
channel.writeInbound(new PingWebSocketFrame(Unpooled.wrappedBuffer(content1)));
channel.writeInbound(new PongWebSocketFrame(Unpooled.wrappedBuffer(content1)));
channel.writeInbound(new ContinuationWebSocketFrame(true, 0, Unpooled.wrappedBuffer(content3)));
assertTrue(channel.finish());
TextWebSocketFrame frame = channel.readInbound();
assertTrue(frame.isFinalFragment());
assertEquals(1, frame.rsv());
assertArrayEquals(content1, toBytes(frame.content()));
PingWebSocketFrame frame2 = channel.readInbound();
assertTrue(frame2.isFinalFragment());
assertEquals(0, frame2.rsv());
assertArrayEquals(content1, toBytes(frame2.content()));
PongWebSocketFrame frame3 = channel.readInbound();
assertTrue(frame3.isFinalFragment());
assertEquals(0, frame3.rsv());
assertArrayEquals(content1, toBytes(frame3.content()));
TextWebSocketFrame frame4 = channel.readInbound();
assertTrue(frame4.isFinalFragment());
assertEquals(0, frame4.rsv());
assertArrayEquals(aggregatedContent, toBytes(frame4.content()));
assertNull(channel.readInbound());
}
Defined In
Source
Frequently Asked Questions
What is the WebSocketFrameAggregatorTest class?
WebSocketFrameAggregatorTest is a class in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketFrameAggregatorTest.java.
Where is WebSocketFrameAggregatorTest defined?
WebSocketFrameAggregatorTest is defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketFrameAggregatorTest.java at line 33.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free