testExecutorPreserveOrdering() — netty Function Reference
Architecture documentation for the testExecutorPreserveOrdering() function in HttpContentCompressorTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 24c68591_6b2f_9742_9e05_ac6ce1a5e175["testExecutorPreserveOrdering()"] 32ab04b0_6c83_d4f7_6483_fd304f908331["HttpContentCompressorTest"] 24c68591_6b2f_9742_9e05_ac6ce1a5e175 -->|defined in| 32ab04b0_6c83_d4f7_6483_fd304f908331 bdf032ba_93a9_0f83_122a_c24ea71efa75["release()"] 24c68591_6b2f_9742_9e05_ac6ce1a5e175 -->|calls| bdf032ba_93a9_0f83_122a_c24ea71efa75 b5923f89_ec88_7b8c_42e2_99970d204fc4["assertEncodedResponse()"] 24c68591_6b2f_9742_9e05_ac6ce1a5e175 -->|calls| b5923f89_ec88_7b8c_42e2_99970d204fc4 style 24c68591_6b2f_9742_9e05_ac6ce1a5e175 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/test/java/io/netty/handler/codec/http/HttpContentCompressorTest.java lines 423–519
@Test
public void testExecutorPreserveOrdering() throws Exception {
final EventLoopGroup compressorGroup = new MultiThreadIoEventLoopGroup(1, LocalIoHandler.newFactory());
EventLoopGroup localGroup = new MultiThreadIoEventLoopGroup(1, LocalIoHandler.newFactory());
Channel server = null;
Channel client = null;
try {
ServerBootstrap bootstrap = new ServerBootstrap()
.channel(LocalServerChannel.class)
.group(localGroup)
.childHandler(new ChannelInitializer<LocalChannel>() {
@Override
protected void initChannel(LocalChannel ch) throws Exception {
ch.pipeline()
.addLast(new HttpServerCodec())
.addLast(new HttpObjectAggregator(1024))
.addLast(compressorGroup, new HttpContentCompressor())
.addLast(new ChannelOutboundHandlerAdapter() {
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
throws Exception {
super.write(ctx, msg, promise);
}
})
.addLast(new ChannelInboundHandlerAdapter() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof FullHttpRequest) {
FullHttpResponse res =
new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK,
Unpooled.copiedBuffer("Hello, World", CharsetUtil.US_ASCII));
ctx.writeAndFlush(res);
ReferenceCountUtil.release(msg);
return;
}
super.channelRead(ctx, msg);
}
});
}
});
LocalAddress address = new LocalAddress(UUID.randomUUID().toString());
server = bootstrap.bind(address).sync().channel();
final BlockingQueue<HttpObject> responses = new LinkedBlockingQueue<HttpObject>();
client = new Bootstrap()
.channel(LocalChannel.class)
.remoteAddress(address)
.group(localGroup)
.handler(new ChannelInitializer<LocalChannel>() {
@Override
protected void initChannel(LocalChannel ch) throws Exception {
ch.pipeline().addLast(new HttpClientCodec()).addLast(new ChannelInboundHandlerAdapter() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof HttpObject) {
responses.put((HttpObject) msg);
return;
}
super.channelRead(ctx, msg);
}
});
}
}).connect().sync().channel();
client.writeAndFlush(newRequest()).sync();
assertEncodedResponse((HttpResponse) responses.poll(1, TimeUnit.SECONDS));
HttpContent c = (HttpContent) responses.poll(1, TimeUnit.SECONDS);
assertNotNull(c);
assertEquals("1f8b0800000000000000f248cdc9c9d75108cf2fca4901000000ffff",
ByteBufUtil.hexDump(c.content()));
c.release();
c = (HttpContent) responses.poll(1, TimeUnit.SECONDS);
assertNotNull(c);
assertEquals("0300c6865b260c000000", ByteBufUtil.hexDump(c.content()));
c.release();
LastHttpContent last = (LastHttpContent) responses.poll(1, TimeUnit.SECONDS);
Domain
Subdomains
Source
Frequently Asked Questions
What does testExecutorPreserveOrdering() do?
testExecutorPreserveOrdering() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentCompressorTest.java.
Where is testExecutorPreserveOrdering() defined?
testExecutorPreserveOrdering() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentCompressorTest.java at line 423.
What does testExecutorPreserveOrdering() call?
testExecutorPreserveOrdering() calls 2 function(s): assertEncodedResponse, release.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free