GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove ability to use different EventExecutorGroup for a ChannelHandler · netty/netty@2b0bbb7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • codec-http/src/test/java/io/netty/handler/codec/http
    • HttpContentCompressorTest.java
  • handler/src/test/java/io/netty/handler/timeout
    • WriteTimeoutHandlerTest.java
  • testsuite/src/main/java/io/netty/testsuite/transport/socket
    • SocketEchoTest.java
    • SocketStartTlsTest.java
  • transport/src
    • main/java/io/netty/channel
      • AbstractChannelHandlerContext.java
      • ChannelOption.java
      • ChannelPipeline.java
      • DefaultChannelConfig.java
      • DefaultChannelHandlerContext.java
      • DefaultChannelPipeline.java
    • test/java/io/netty/channel
      • AbstractEventLoopTest.java
      • ChannelInitializerTest.java
      • ChannelOutboundBufferTest.java
      • DefaultChannelPipelineTest.java
      • local
        • LocalTransportThreadModelTest.java
        • LocalTransportThreadModelTest3.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎codec-http/src/test/java/io/netty/handler/codec/http/HttpContentCompressorTest.java‎

Copy file name to clipboardExpand all lines: codec-http/src/test/java/io/netty/handler/codec/http/HttpContentCompressorTest.java
-117Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,11 @@
1717

1818
import com.aayushatharva.brotli4j.decoder.DecoderJNI;
1919
import com.aayushatharva.brotli4j.decoder.DirectDecompress;
20-
import io.netty.bootstrap.Bootstrap;
21-
import io.netty.bootstrap.ServerBootstrap;
2220
import io.netty.buffer.ByteBuf;
2321
import io.netty.buffer.ByteBufUtil;
2422
import io.netty.buffer.CompositeByteBuf;
2523
import io.netty.buffer.Unpooled;
26-
import io.netty.channel.Channel;
27-
import io.netty.channel.ChannelHandlerContext;
28-
import io.netty.channel.ChannelInboundHandlerAdapter;
29-
import io.netty.channel.ChannelInitializer;
30-
import io.netty.channel.ChannelOutboundHandlerAdapter;
31-
import io.netty.channel.ChannelPromise;
32-
import io.netty.channel.DefaultEventLoopGroup;
33-
import io.netty.channel.EventLoopGroup;
3424
import io.netty.channel.embedded.EmbeddedChannel;
35-
import io.netty.channel.local.LocalAddress;
36-
import io.netty.channel.local.LocalChannel;
37-
import io.netty.channel.local.LocalServerChannel;
3825
import io.netty.handler.codec.DecoderResult;
3926
import io.netty.handler.codec.EncoderException;
4027
import io.netty.handler.codec.compression.Brotli;
@@ -43,11 +30,6 @@
4330
import io.netty.util.CharsetUtil;
4431
import io.netty.util.ReferenceCountUtil;
4532

46-
import java.util.UUID;
47-
import java.util.concurrent.BlockingQueue;
48-
import java.util.concurrent.LinkedBlockingQueue;
49-
import java.util.concurrent.TimeUnit;
50-
5133
import org.junit.jupiter.api.Test;
5234
import org.junit.jupiter.api.condition.EnabledIf;
5335

@@ -58,7 +40,6 @@
5840
import static org.junit.jupiter.api.Assertions.assertEquals;
5941
import static org.junit.jupiter.api.Assertions.assertFalse;
6042
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
61-
import static org.junit.jupiter.api.Assertions.assertNotNull;
6243
import static org.junit.jupiter.api.Assertions.assertNull;
6344
import static org.junit.jupiter.api.Assertions.assertSame;
6445
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -419,104 +400,6 @@ public void testFullContent() throws Exception {
419400
assertNull(ch.readOutbound());
420401
}
421402

422-
@Test
423-
public void testExecutorPreserveOrdering() throws Exception {
424-
final EventLoopGroup compressorGroup = new DefaultEventLoopGroup(1);
425-
EventLoopGroup localGroup = new DefaultEventLoopGroup(1);
426-
Channel server = null;
427-
Channel client = null;
428-
try {
429-
ServerBootstrap bootstrap = new ServerBootstrap()
430-
.channel(LocalServerChannel.class)
431-
.group(localGroup)
432-
.childHandler(new ChannelInitializer<LocalChannel>() {
433-
@Override
434-
protected void initChannel(LocalChannel ch) throws Exception {
435-
ch.pipeline()
436-
.addLast(new HttpServerCodec())
437-
.addLast(new HttpObjectAggregator(1024))
438-
.addLast(compressorGroup, new HttpContentCompressor())
439-
.addLast(new ChannelOutboundHandlerAdapter() {
440-
@Override
441-
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
442-
throws Exception {
443-
super.write(ctx, msg, promise);
444-
}
445-
})
446-
.addLast(new ChannelInboundHandlerAdapter() {
447-
@Override
448-
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
449-
if (msg instanceof FullHttpRequest) {
450-
FullHttpResponse res =
451-
new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK,
452-
Unpooled.copiedBuffer("Hello, World", CharsetUtil.US_ASCII));
453-
ctx.writeAndFlush(res);
454-
ReferenceCountUtil.release(msg);
455-
return;
456-
}
457-
super.channelRead(ctx, msg);
458-
}
459-
});
460-
}
461-
});
462-
463-
LocalAddress address = new LocalAddress(UUID.randomUUID().toString());
464-
server = bootstrap.bind(address).sync().channel();
465-
466-
final BlockingQueue<HttpObject> responses = new LinkedBlockingQueue<HttpObject>();
467-
468-
client = new Bootstrap()
469-
.channel(LocalChannel.class)
470-
.remoteAddress(address)
471-
.group(localGroup)
472-
.handler(new ChannelInitializer<LocalChannel>() {
473-
@Override
474-
protected void initChannel(LocalChannel ch) throws Exception {
475-
ch.pipeline().addLast(new HttpClientCodec()).addLast(new ChannelInboundHandlerAdapter() {
476-
@Override
477-
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
478-
if (msg instanceof HttpObject) {
479-
responses.put((HttpObject) msg);
480-
return;
481-
}
482-
super.channelRead(ctx, msg);
483-
}
484-
});
485-
}
486-
}).connect().sync().channel();
487-
488-
client.writeAndFlush(newRequest()).sync();
489-
490-
assertEncodedResponse((HttpResponse) responses.poll(1, TimeUnit.SECONDS));
491-
HttpContent c = (HttpContent) responses.poll(1, TimeUnit.SECONDS);
492-
assertNotNull(c);
493-
assertEquals("1f8b0800000000000000f248cdc9c9d75108cf2fca4901000000ffff",
494-
ByteBufUtil.hexDump(c.content()));
495-
c.release();
496-
497-
c = (HttpContent) responses.poll(1, TimeUnit.SECONDS);
498-
assertNotNull(c);
499-
assertEquals("0300c6865b260c000000", ByteBufUtil.hexDump(c.content()));
500-
c.release();
501-
502-
LastHttpContent last = (LastHttpContent) responses.poll(1, TimeUnit.SECONDS);
503-
assertNotNull(last);
504-
assertEquals(0, last.content().readableBytes());
505-
last.release();
506-
507-
assertNull(responses.poll(1, TimeUnit.SECONDS));
508-
} finally {
509-
if (client != null) {
510-
client.close().sync();
511-
}
512-
if (server != null) {
513-
server.close().sync();
514-
}
515-
compressorGroup.shutdownGracefully();
516-
localGroup.shutdownGracefully();
517-
}
518-
}
519-
520403
/**
521404
* If the length of the content is unknown, {@link HttpContentEncoder} should not skip encoding the content
522405
* even if the actual length is turned out to be 0.
Collapse file

‎handler/src/test/java/io/netty/handler/timeout/WriteTimeoutHandlerTest.java‎

Copy file name to clipboardExpand all lines: handler/src/test/java/io/netty/handler/timeout/WriteTimeoutHandlerTest.java
-61Lines changed: 0 additions & 61 deletions
This file was deleted.
Collapse file

‎testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java‎

Copy file name to clipboardExpand all lines: testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketEchoTest.java
+13-88Lines changed: 13 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,10 @@
2121
import io.netty.channel.Channel;
2222
import io.netty.channel.ChannelHandlerContext;
2323
import io.netty.channel.ChannelInboundHandlerAdapter;
24-
import io.netty.channel.ChannelInitializer;
2524
import io.netty.channel.ChannelOption;
2625
import io.netty.channel.SimpleChannelInboundHandler;
27-
import io.netty.util.concurrent.DefaultEventExecutorGroup;
28-
import io.netty.util.concurrent.EventExecutorGroup;
2926
import java.util.concurrent.TimeUnit;
3027

31-
import org.junit.jupiter.api.AfterAll;
32-
import org.junit.jupiter.api.BeforeAll;
3328
import org.junit.jupiter.api.Test;
3429

3530
import java.io.IOException;
@@ -47,22 +42,10 @@ public class SocketEchoTest extends AbstractSocketTest {
4742
private static final Random random = new Random();
4843
static final byte[] data = new byte[1048576];
4944

50-
private static EventExecutorGroup group;
51-
5245
static {
5346
random.nextBytes(data);
5447
}
5548

56-
@BeforeAll
57-
public static void createGroup() {
58-
group = new DefaultEventExecutorGroup(2);
59-
}
60-
61-
@AfterAll
62-
public static void destroyGroup() throws Exception {
63-
group.shutdownGracefully().sync();
64-
}
65-
6649
@Test
6750
@Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
6851
public void testSimpleEcho(TestInfo testInfo) throws Throwable {
@@ -75,7 +58,7 @@ public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Thr
7558
}
7659

7760
public void testSimpleEcho(ServerBootstrap sb, Bootstrap cb) throws Throwable {
78-
testSimpleEcho0(sb, cb, false, false, true);
61+
testSimpleEcho0(sb, cb, false, true);
7962
}
8063

8164
@Test
@@ -90,35 +73,7 @@ public void run(ServerBootstrap sb1, Bootstrap cb1) throws Throwable {
9073
}
9174

9275
public void testSimpleEchoNotAutoRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
93-
testSimpleEcho0(sb, cb, false, false, false);
94-
}
95-
96-
@Test
97-
public void testSimpleEchoWithAdditionalExecutor(TestInfo testInfo) throws Throwable {
98-
run(testInfo, new Runner<ServerBootstrap, Bootstrap>() {
99-
@Override
100-
public void run(ServerBootstrap sb1, Bootstrap cb1) throws Throwable {
101-
testSimpleEchoWithAdditionalExecutor(sb1, cb1);
102-
}
103-
});
104-
}
105-
106-
public void testSimpleEchoWithAdditionalExecutor(ServerBootstrap sb, Bootstrap cb) throws Throwable {
107-
testSimpleEcho0(sb, cb, true, false, true);
108-
}
109-
110-
@Test
111-
public void testSimpleEchoWithAdditionalExecutorNotAutoRead(TestInfo testInfo) throws Throwable {
112-
run(testInfo, new Runner<ServerBootstrap, Bootstrap>() {
113-
@Override
114-
public void run(ServerBootstrap sb1, Bootstrap cb1) throws Throwable {
115-
testSimpleEchoWithAdditionalExecutorNotAutoRead(sb1, cb1);
116-
}
117-
});
118-
}
119-
120-
public void testSimpleEchoWithAdditionalExecutorNotAutoRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
121-
testSimpleEcho0(sb, cb, true, false, false);
76+
testSimpleEcho0(sb, cb, false, false);
12277
}
12378

12479
@Test
@@ -132,7 +87,7 @@ public void run(ServerBootstrap sb1, Bootstrap cb1) throws Throwable {
13287
}
13388

13489
public void testSimpleEchoWithVoidPromise(ServerBootstrap sb, Bootstrap cb) throws Throwable {
135-
testSimpleEcho0(sb, cb, false, true, true);
90+
testSimpleEcho0(sb, cb, true, true);
13691
}
13792

13893
@Test
@@ -146,54 +101,24 @@ public void run(ServerBootstrap sb1, Bootstrap cb1) throws Throwable {
146101
}
147102

148103
public void testSimpleEchoWithVoidPromiseNotAutoRead(ServerBootstrap sb, Bootstrap cb) throws Throwable {
149-
testSimpleEcho0(sb, cb, false, true, false);
150-
}
151-
152-
@Test
153-
@Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
154-
public void testSimpleEchoWithAdditionalExecutorAndVoidPromise(TestInfo testInfo) throws Throwable {
155-
run(testInfo, new Runner<ServerBootstrap, Bootstrap>() {
156-
@Override
157-
public void run(ServerBootstrap sb1, Bootstrap cb1) throws Throwable {
158-
testSimpleEchoWithAdditionalExecutorAndVoidPromise(sb1, cb1);
159-
}
160-
});
161-
}
162-
163-
public void testSimpleEchoWithAdditionalExecutorAndVoidPromise(ServerBootstrap sb, Bootstrap cb) throws Throwable {
164-
testSimpleEcho0(sb, cb, true, true, true);
104+
testSimpleEcho0(sb, cb, true, false);
165105
}
166106

167107
private static void testSimpleEcho0(
168-
ServerBootstrap sb, Bootstrap cb, boolean additionalExecutor, boolean voidPromise, boolean autoRead)
108+
ServerBootstrap sb, Bootstrap cb, boolean voidPromise, boolean autoRead)
169109
throws Throwable {
170110

171111
final EchoHandler sh = new EchoHandler(autoRead);
172112
final EchoHandler ch = new EchoHandler(autoRead);
173113

174-
if (additionalExecutor) {
175-
sb.childHandler(new ChannelInitializer<Channel>() {
176-
@Override
177-
protected void initChannel(Channel c) throws Exception {
178-
c.pipeline().addLast(group, sh);
179-
}
180-
});
181-
cb.handler(new ChannelInitializer<Channel>() {
182-
@Override
183-
protected void initChannel(Channel c) throws Exception {
184-
c.pipeline().addLast(group, ch);
185-
}
186-
});
187-
} else {
188-
sb.childHandler(sh);
189-
sb.handler(new ChannelInboundHandlerAdapter() {
190-
@Override
191-
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
192-
cause.printStackTrace();
193-
}
194-
});
195-
cb.handler(ch);
196-
}
114+
sb.childHandler(sh);
115+
sb.handler(new ChannelInboundHandlerAdapter() {
116+
@Override
117+
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
118+
cause.printStackTrace();
119+
}
120+
});
121+
cb.handler(ch);
197122
sb.childOption(ChannelOption.AUTO_READ, autoRead);
198123
cb.option(ChannelOption.AUTO_READ, autoRead);
199124

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.