Deprecate ChannelInboundHandlerAdapter and ChannelOutboundHandlerAdapter (#8929)
Motivation: As we now us java8 as minimum java version we can deprecate ChannelInboundHandlerAdapter / ChannelOutboundHandlerAdapter and just move the default implementations into the interfaces. This makes things a bit more flexible for the end-user and also simplifies the class-hierarchy. Modifications: - Mark ChannelInboundHandlerAdapter and ChannelOutboundHandlerAdapter as deprecated - Add default implementations to ChannelInboundHandler / ChannelOutboundHandler - Refactor our code to not use ChannelInboundHandlerAdapter / ChannelOutboundHandlerAdapter anymore Result: Cleanup class-hierarchy and make things a bit more flexible.
This commit is contained in:
parent
2720a40a20
commit
42742e233f
@ -18,7 +18,7 @@ package io.netty.handler.codec.http;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
|
|
||||||
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH;
|
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH;
|
||||||
@ -44,7 +44,7 @@ import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
|
|||||||
* </pre>
|
* </pre>
|
||||||
* </blockquote>
|
* </blockquote>
|
||||||
*/
|
*/
|
||||||
public class HttpServerExpectContinueHandler extends ChannelInboundHandlerAdapter {
|
public class HttpServerExpectContinueHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private static final FullHttpResponse EXPECTATION_FAILED = new DefaultFullHttpResponse(
|
private static final FullHttpResponse EXPECTATION_FAILED = new DefaultFullHttpResponse(
|
||||||
HTTP_1_1, HttpResponseStatus.EXPECTATION_FAILED, Unpooled.EMPTY_BUFFER);
|
HTTP_1_1, HttpResponseStatus.EXPECTATION_FAILED, Unpooled.EMPTY_BUFFER);
|
||||||
@ -92,6 +92,6 @@ public class HttpServerExpectContinueHandler extends ChannelInboundHandlerAdapte
|
|||||||
req.headers().remove(HttpHeaderNames.EXPECT);
|
req.headers().remove(HttpHeaderNames.EXPECT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.channelRead(ctx, msg);
|
ctx.fireChannelRead(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,13 +19,13 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.handler.codec.CorruptedFrameException;
|
import io.netty.handler.codec.CorruptedFrameException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Utf8FrameValidator extends ChannelInboundHandlerAdapter {
|
public class Utf8FrameValidator implements ChannelInboundHandler {
|
||||||
|
|
||||||
private int fragmentedFramesCount;
|
private int fragmentedFramesCount;
|
||||||
private Utf8Validator utf8Validator;
|
private Utf8Validator utf8Validator;
|
||||||
@ -74,7 +74,7 @@ public class Utf8FrameValidator extends ChannelInboundHandlerAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.channelRead(ctx, msg);
|
ctx.fireChannelRead(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkUTF8String(ByteBuf buffer) {
|
private void checkUTF8String(ByteBuf buffer) {
|
||||||
@ -89,6 +89,6 @@ public class Utf8FrameValidator extends ChannelInboundHandlerAdapter {
|
|||||||
if (cause instanceof CorruptedFrameException && ctx.channel().isOpen()) {
|
if (cause instanceof CorruptedFrameException && ctx.channel().isOpen()) {
|
||||||
ctx.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
ctx.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||||
}
|
}
|
||||||
super.exceptionCaught(ctx, cause);
|
ctx.fireExceptionCaught(cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package io.netty.handler.codec.http.websocketx;
|
package io.netty.handler.codec.http.websocketx;
|
||||||
|
|
||||||
import io.netty.channel.ChannelFuture;
|
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.handler.codec.http.FullHttpResponse;
|
import io.netty.handler.codec.http.FullHttpResponse;
|
||||||
|
|
||||||
class WebSocketClientProtocolHandshakeHandler extends ChannelInboundHandlerAdapter {
|
class WebSocketClientProtocolHandshakeHandler implements ChannelInboundHandler {
|
||||||
private final WebSocketClientHandshaker handshaker;
|
private final WebSocketClientHandshaker handshaker;
|
||||||
|
|
||||||
WebSocketClientProtocolHandshakeHandler(WebSocketClientHandshaker handshaker) {
|
WebSocketClientProtocolHandshakeHandler(WebSocketClientHandshaker handshaker) {
|
||||||
@ -30,7 +29,7 @@ class WebSocketClientProtocolHandshakeHandler extends ChannelInboundHandlerAdapt
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
||||||
super.channelActive(ctx);
|
ctx.fireChannelActive();
|
||||||
handshaker.handshake(ctx.channel()).addListener((ChannelFutureListener) future -> {
|
handshaker.handshake(ctx.channel()).addListener((ChannelFutureListener) future -> {
|
||||||
if (!future.isSuccess()) {
|
if (!future.isSuccess()) {
|
||||||
ctx.fireExceptionCaught(future.cause());
|
ctx.fireExceptionCaught(future.cause());
|
||||||
|
@ -21,7 +21,6 @@ import io.netty.channel.ChannelFutureListener;
|
|||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandler;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.handler.codec.http.DefaultFullHttpResponse;
|
import io.netty.handler.codec.http.DefaultFullHttpResponse;
|
||||||
import io.netty.handler.codec.http.FullHttpRequest;
|
import io.netty.handler.codec.http.FullHttpRequest;
|
||||||
@ -199,7 +198,7 @@ public class WebSocketServerProtocolHandler extends WebSocketProtocolHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ChannelHandler forbiddenHttpRequestResponder() {
|
static ChannelHandler forbiddenHttpRequestResponder() {
|
||||||
return new ChannelInboundHandlerAdapter() {
|
return new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
if (msg instanceof FullHttpRequest) {
|
if (msg instanceof FullHttpRequest) {
|
||||||
|
@ -18,7 +18,7 @@ package io.netty.handler.codec.http.websocketx;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.handler.codec.http.DefaultFullHttpResponse;
|
import io.netty.handler.codec.http.DefaultFullHttpResponse;
|
||||||
import io.netty.handler.codec.http.FullHttpRequest;
|
import io.netty.handler.codec.http.FullHttpRequest;
|
||||||
@ -35,7 +35,7 @@ import static io.netty.handler.codec.http.HttpVersion.*;
|
|||||||
/**
|
/**
|
||||||
* Handles the HTTP handshake (the HTTP Upgrade request) for {@link WebSocketServerProtocolHandler}.
|
* Handles the HTTP handshake (the HTTP Upgrade request) for {@link WebSocketServerProtocolHandler}.
|
||||||
*/
|
*/
|
||||||
class WebSocketServerProtocolHandshakeHandler extends ChannelInboundHandlerAdapter {
|
class WebSocketServerProtocolHandshakeHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private final String websocketPath;
|
private final String websocketPath;
|
||||||
private final String subprotocols;
|
private final String subprotocols;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
package io.netty.handler.codec.http;
|
package io.netty.handler.codec.http;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -58,7 +58,7 @@ public class HttpClientUpgradeHandlerTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class UserEventCatcher extends ChannelInboundHandlerAdapter {
|
private static final class UserEventCatcher implements ChannelInboundHandler {
|
||||||
private Object evt;
|
private Object evt;
|
||||||
|
|
||||||
public Object getUserEvent() {
|
public Object getUserEvent() {
|
||||||
|
@ -19,7 +19,7 @@ package io.netty.handler.codec.http;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.CodecException;
|
import io.netty.handler.codec.CodecException;
|
||||||
import io.netty.handler.codec.DecoderException;
|
import io.netty.handler.codec.DecoderException;
|
||||||
@ -274,7 +274,7 @@ public class HttpContentDecoderTest {
|
|||||||
final int maxBytes = 10;
|
final int maxBytes = 10;
|
||||||
HttpObjectAggregator aggregator = new HttpObjectAggregator(maxBytes);
|
HttpObjectAggregator aggregator = new HttpObjectAggregator(maxBytes);
|
||||||
final AtomicReference<FullHttpRequest> secondRequestRef = new AtomicReference<>();
|
final AtomicReference<FullHttpRequest> secondRequestRef = new AtomicReference<>();
|
||||||
EmbeddedChannel channel = new EmbeddedChannel(decoder, aggregator, new ChannelInboundHandlerAdapter() {
|
EmbeddedChannel channel = new EmbeddedChannel(decoder, aggregator, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
if (msg instanceof FullHttpRequest) {
|
if (msg instanceof FullHttpRequest) {
|
||||||
@ -531,7 +531,7 @@ public class HttpContentDecoderTest {
|
|||||||
HttpContentDecoder decoder = new HttpContentDecoder() {
|
HttpContentDecoder decoder = new HttpContentDecoder() {
|
||||||
@Override
|
@Override
|
||||||
protected EmbeddedChannel newContentDecoder(String contentEncoding) throws Exception {
|
protected EmbeddedChannel newContentDecoder(String contentEncoding) throws Exception {
|
||||||
return new EmbeddedChannel(new ChannelInboundHandlerAdapter() {
|
return new EmbeddedChannel(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
ctx.fireExceptionCaught(new DecoderException());
|
ctx.fireExceptionCaught(new DecoderException());
|
||||||
@ -542,11 +542,11 @@ public class HttpContentDecoderTest {
|
|||||||
};
|
};
|
||||||
|
|
||||||
final AtomicBoolean channelInactiveCalled = new AtomicBoolean();
|
final AtomicBoolean channelInactiveCalled = new AtomicBoolean();
|
||||||
EmbeddedChannel channel = new EmbeddedChannel(decoder, new ChannelInboundHandlerAdapter() {
|
EmbeddedChannel channel = new EmbeddedChannel(decoder, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
assertTrue(channelInactiveCalled.compareAndSet(false, true));
|
assertTrue(channelInactiveCalled.compareAndSet(false, true));
|
||||||
super.channelInactive(ctx);
|
ctx.fireChannelInactive();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
assertTrue(channel.writeInbound(new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/")));
|
assertTrue(channel.writeInbound(new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/")));
|
||||||
|
@ -17,8 +17,9 @@ package io.netty.handler.codec.http;
|
|||||||
|
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
|
||||||
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -31,13 +32,13 @@ public class HttpContentDecompressorTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testInvokeReadWhenNotProduceMessage() {
|
public void testInvokeReadWhenNotProduceMessage() {
|
||||||
final AtomicInteger readCalled = new AtomicInteger();
|
final AtomicInteger readCalled = new AtomicInteger();
|
||||||
EmbeddedChannel channel = new EmbeddedChannel(new ChannelOutboundHandlerAdapter() {
|
EmbeddedChannel channel = new EmbeddedChannel(new ChannelOutboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void read(ChannelHandlerContext ctx) {
|
public void read(ChannelHandlerContext ctx) {
|
||||||
readCalled.incrementAndGet();
|
readCalled.incrementAndGet();
|
||||||
ctx.read();
|
ctx.read();
|
||||||
}
|
}
|
||||||
}, new HttpContentDecompressor(), new ChannelInboundHandlerAdapter() {
|
}, new HttpContentDecompressor(), new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
ctx.fireChannelRead(msg);
|
ctx.fireChannelRead(msg);
|
||||||
|
@ -19,7 +19,7 @@ package io.netty.handler.codec.http;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.CodecException;
|
import io.netty.handler.codec.CodecException;
|
||||||
import io.netty.handler.codec.DecoderResult;
|
import io.netty.handler.codec.DecoderResult;
|
||||||
@ -397,7 +397,7 @@ public class HttpContentEncoderTest {
|
|||||||
@Override
|
@Override
|
||||||
protected Result beginEncode(HttpResponse headers, String acceptEncoding) throws Exception {
|
protected Result beginEncode(HttpResponse headers, String acceptEncoding) throws Exception {
|
||||||
return new Result("myencoding", new EmbeddedChannel(
|
return new Result("myencoding", new EmbeddedChannel(
|
||||||
new ChannelInboundHandlerAdapter() {
|
new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
ctx.fireExceptionCaught(new EncoderException());
|
ctx.fireExceptionCaught(new EncoderException());
|
||||||
@ -408,11 +408,11 @@ public class HttpContentEncoderTest {
|
|||||||
};
|
};
|
||||||
|
|
||||||
final AtomicBoolean channelInactiveCalled = new AtomicBoolean();
|
final AtomicBoolean channelInactiveCalled = new AtomicBoolean();
|
||||||
EmbeddedChannel channel = new EmbeddedChannel(encoder, new ChannelInboundHandlerAdapter() {
|
EmbeddedChannel channel = new EmbeddedChannel(encoder, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
assertTrue(channelInactiveCalled.compareAndSet(false, true));
|
assertTrue(channelInactiveCalled.compareAndSet(false, true));
|
||||||
super.channelInactive(ctx);
|
ctx.fireChannelInactive();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
assertTrue(channel.writeInbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/")));
|
assertTrue(channel.writeInbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/")));
|
||||||
|
@ -18,16 +18,15 @@ package io.netty.handler.codec.http;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelDuplexHandler;
|
import io.netty.channel.ChannelDuplexHandler;
|
||||||
import io.netty.channel.ChannelFuture;
|
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodec;
|
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodec;
|
||||||
@ -57,7 +56,7 @@ public class HttpServerUpgradeHandlerTest {
|
|||||||
assertNotNull(ctx.pipeline().get(HttpServerUpgradeHandler.class));
|
assertNotNull(ctx.pipeline().get(HttpServerUpgradeHandler.class));
|
||||||
|
|
||||||
// Add a marker handler to signal that the upgrade has happened
|
// Add a marker handler to signal that the upgrade has happened
|
||||||
ctx.pipeline().addAfter(ctx.name(), "marker", new ChannelInboundHandlerAdapter());
|
ctx.pipeline().addAfter(ctx.name(), "marker", new ChannelInboundHandler() { });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ package io.netty.handler.codec.http.websocketx;
|
|||||||
|
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.http.DefaultFullHttpRequest;
|
import io.netty.handler.codec.http.DefaultFullHttpRequest;
|
||||||
@ -154,7 +154,7 @@ public class WebSocketServerProtocolHandlerTest {
|
|||||||
return new String(response.content().array());
|
return new String(response.content().array());
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MockOutboundHandler extends ChannelOutboundHandlerAdapter {
|
private class MockOutboundHandler implements ChannelOutboundHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
|
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
|
||||||
@ -167,7 +167,7 @@ public class WebSocketServerProtocolHandlerTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class CustomTextFrameHandler extends ChannelInboundHandlerAdapter {
|
private static class CustomTextFrameHandler implements ChannelInboundHandler {
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
package io.netty.handler.codec.http2;
|
package io.netty.handler.codec.http2;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.handler.codec.http.FullHttpMessage;
|
import io.netty.handler.codec.http.FullHttpMessage;
|
||||||
import io.netty.handler.codec.http.HttpHeaders;
|
import io.netty.handler.codec.http.HttpHeaders;
|
||||||
import io.netty.handler.codec.http.HttpScheme;
|
import io.netty.handler.codec.http.HttpScheme;
|
||||||
@ -26,7 +26,7 @@ import io.netty.util.internal.UnstableApi;
|
|||||||
* Translates HTTP/1.x object reads into HTTP/2 frames.
|
* Translates HTTP/1.x object reads into HTTP/2 frames.
|
||||||
*/
|
*/
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public class InboundHttpToHttp2Adapter extends ChannelInboundHandlerAdapter {
|
public class InboundHttpToHttp2Adapter implements ChannelInboundHandler {
|
||||||
private final Http2Connection connection;
|
private final Http2Connection connection;
|
||||||
private final Http2FrameListener listener;
|
private final Http2FrameListener listener;
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ public class InboundHttpToHttp2Adapter extends ChannelInboundHandlerAdapter {
|
|||||||
if (msg instanceof FullHttpMessage) {
|
if (msg instanceof FullHttpMessage) {
|
||||||
handle(ctx, connection, listener, (FullHttpMessage) msg);
|
handle(ctx, connection, listener, (FullHttpMessage) msg);
|
||||||
} else {
|
} else {
|
||||||
super.channelRead(ctx, msg);
|
ctx.fireChannelRead(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.http.DefaultHttpHeaders;
|
import io.netty.handler.codec.http.DefaultHttpHeaders;
|
||||||
@ -27,7 +27,6 @@ import io.netty.handler.codec.http.HttpMethod;
|
|||||||
import io.netty.handler.codec.http.HttpRequest;
|
import io.netty.handler.codec.http.HttpRequest;
|
||||||
import io.netty.handler.codec.http.HttpServerCodec;
|
import io.netty.handler.codec.http.HttpServerCodec;
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler;
|
import io.netty.handler.codec.http.HttpServerUpgradeHandler;
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodec;
|
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodecFactory;
|
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodecFactory;
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeEvent;
|
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeEvent;
|
||||||
import io.netty.handler.codec.http.HttpVersion;
|
import io.netty.handler.codec.http.HttpVersion;
|
||||||
@ -79,7 +78,7 @@ public class CleartextHttp2ServerUpgradeHandlerTest {
|
|||||||
|
|
||||||
CleartextHttp2ServerUpgradeHandler handler = new CleartextHttp2ServerUpgradeHandler(
|
CleartextHttp2ServerUpgradeHandler handler = new CleartextHttp2ServerUpgradeHandler(
|
||||||
httpServerCodec, upgradeHandler, http2ConnectionHandler);
|
httpServerCodec, upgradeHandler, http2ConnectionHandler);
|
||||||
channel = new EmbeddedChannel(handler, new ChannelInboundHandlerAdapter() {
|
channel = new EmbeddedChannel(handler, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
userEvents.add(evt);
|
userEvents.add(evt);
|
||||||
@ -205,7 +204,7 @@ public class CleartextHttp2ServerUpgradeHandlerTest {
|
|||||||
|
|
||||||
CleartextHttp2ServerUpgradeHandler handler = new CleartextHttp2ServerUpgradeHandler(
|
CleartextHttp2ServerUpgradeHandler handler = new CleartextHttp2ServerUpgradeHandler(
|
||||||
httpServerCodec, upgradeHandler, http2Codec);
|
httpServerCodec, upgradeHandler, http2Codec);
|
||||||
channel = new EmbeddedChannel(handler, new ChannelInboundHandlerAdapter() {
|
channel = new EmbeddedChannel(handler, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
userEvents.add(evt);
|
userEvents.add(evt);
|
||||||
|
@ -21,7 +21,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
@ -31,7 +31,6 @@ import io.netty.channel.socket.nio.NioServerSocketChannel;
|
|||||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||||
import io.netty.handler.codec.http.HttpHeaderNames;
|
import io.netty.handler.codec.http.HttpHeaderNames;
|
||||||
import io.netty.handler.codec.http.HttpHeaderValues;
|
import io.netty.handler.codec.http.HttpHeaderValues;
|
||||||
import io.netty.handler.codec.http2.Http2TestUtil.Http2Runnable;
|
|
||||||
import io.netty.util.AsciiString;
|
import io.netty.util.AsciiString;
|
||||||
import io.netty.util.CharsetUtil;
|
import io.netty.util.CharsetUtil;
|
||||||
import io.netty.util.NetUtil;
|
import io.netty.util.NetUtil;
|
||||||
@ -41,8 +40,6 @@ import org.junit.Before;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
import org.mockito.invocation.InvocationOnMock;
|
|
||||||
import org.mockito.stubbing.Answer;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -323,7 +320,7 @@ public class DataCompressionHttp2Test {
|
|||||||
.gracefulShutdownTimeoutMillis(0)
|
.gracefulShutdownTimeoutMillis(0)
|
||||||
.codec(decoder, clientEncoder).build();
|
.codec(decoder, clientEncoder).build();
|
||||||
p.addLast(clientHandler);
|
p.addLast(clientHandler);
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt == Http2ConnectionPrefaceAndSettingsFrameWrittenEvent.INSTANCE) {
|
if (evt == Http2ConnectionPrefaceAndSettingsFrameWrittenEvent.INSTANCE) {
|
||||||
prefaceWrittenLatch.countDown();
|
prefaceWrittenLatch.countDown();
|
||||||
|
@ -16,7 +16,7 @@ package io.netty.handler.codec.http2;
|
|||||||
|
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.http.DefaultFullHttpRequest;
|
import io.netty.handler.codec.http.DefaultFullHttpRequest;
|
||||||
import io.netty.handler.codec.http.FullHttpRequest;
|
import io.netty.handler.codec.http.FullHttpRequest;
|
||||||
@ -44,13 +44,13 @@ public class Http2ClientUpgradeCodecTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testUpgradeToHttp2MultiplexCodec() throws Exception {
|
public void testUpgradeToHttp2MultiplexCodec() throws Exception {
|
||||||
testUpgrade(Http2MultiplexCodecBuilder.forClient(new HttpInboundHandler())
|
testUpgrade(Http2MultiplexCodecBuilder.forClient(new HttpInboundHandler())
|
||||||
.withUpgradeStreamHandler(new ChannelInboundHandlerAdapter()).build());
|
.withUpgradeStreamHandler(new ChannelInboundHandler() { }).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void testUpgrade(Http2ConnectionHandler handler) throws Exception {
|
private static void testUpgrade(Http2ConnectionHandler handler) throws Exception {
|
||||||
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.OPTIONS, "*");
|
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.OPTIONS, "*");
|
||||||
|
|
||||||
EmbeddedChannel channel = new EmbeddedChannel(new ChannelInboundHandlerAdapter());
|
EmbeddedChannel channel = new EmbeddedChannel(new ChannelInboundHandler() { });
|
||||||
ChannelHandlerContext ctx = channel.pipeline().firstContext();
|
ChannelHandlerContext ctx = channel.pipeline().firstContext();
|
||||||
Http2ClientUpgradeCodec codec = new Http2ClientUpgradeCodec("connectionHandler", handler);
|
Http2ClientUpgradeCodec codec = new Http2ClientUpgradeCodec("connectionHandler", handler);
|
||||||
codec.setUpgradeHeaders(ctx, request);
|
codec.setUpgradeHeaders(ctx, request);
|
||||||
@ -64,5 +64,5 @@ public class Http2ClientUpgradeCodecTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
private static final class HttpInboundHandler extends ChannelInboundHandlerAdapter { }
|
private static final class HttpInboundHandler implements ChannelInboundHandler { }
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,9 @@ import io.netty.channel.ChannelFuture;
|
|||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerAdapter;
|
import io.netty.channel.ChannelHandlerAdapter;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
@ -36,7 +36,6 @@ import io.netty.channel.local.LocalChannel;
|
|||||||
import io.netty.channel.local.LocalHandler;
|
import io.netty.channel.local.LocalHandler;
|
||||||
import io.netty.channel.local.LocalServerChannel;
|
import io.netty.channel.local.LocalServerChannel;
|
||||||
import io.netty.handler.codec.http2.Http2TestUtil.FrameCountDown;
|
import io.netty.handler.codec.http2.Http2TestUtil.FrameCountDown;
|
||||||
import io.netty.handler.codec.http2.Http2TestUtil.Http2Runnable;
|
|
||||||
import io.netty.util.AsciiString;
|
import io.netty.util.AsciiString;
|
||||||
import io.netty.util.IllegalReferenceCountException;
|
import io.netty.util.IllegalReferenceCountException;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
@ -643,7 +642,7 @@ public class Http2ConnectionRoundtripTest {
|
|||||||
runInChannel(clientChannel, () -> {
|
runInChannel(clientChannel, () -> {
|
||||||
http2Client.encoder().writeHeaders(ctx(), 3, EmptyHttp2Headers.INSTANCE, 0, (short) 16, false, 0, false,
|
http2Client.encoder().writeHeaders(ctx(), 3, EmptyHttp2Headers.INSTANCE, 0, (short) 16, false, 0, false,
|
||||||
newPromise());
|
newPromise());
|
||||||
clientChannel.pipeline().addFirst(new ChannelOutboundHandlerAdapter() {
|
clientChannel.pipeline().addFirst(new ChannelOutboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
|
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
|
||||||
ReferenceCountUtil.release(msg);
|
ReferenceCountUtil.release(msg);
|
||||||
@ -1062,7 +1061,7 @@ public class Http2ConnectionRoundtripTest {
|
|||||||
.validateHeaders(false)
|
.validateHeaders(false)
|
||||||
.gracefulShutdownTimeoutMillis(0)
|
.gracefulShutdownTimeoutMillis(0)
|
||||||
.build());
|
.build());
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt == Http2ConnectionPrefaceAndSettingsFrameWrittenEvent.INSTANCE) {
|
if (evt == Http2ConnectionPrefaceAndSettingsFrameWrittenEvent.INSTANCE) {
|
||||||
|
@ -19,7 +19,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.UnsupportedMessageTypeException;
|
import io.netty.handler.codec.UnsupportedMessageTypeException;
|
||||||
@ -779,7 +779,7 @@ public class Http2FrameCodecTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void upgradeWithoutFlowControlling() throws Exception {
|
public void upgradeWithoutFlowControlling() throws Exception {
|
||||||
channel.pipeline().addAfter(frameCodec.ctx.name(), null, new ChannelInboundHandlerAdapter() {
|
channel.pipeline().addAfter(frameCodec.ctx.name(), null, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(final ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(final ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
if (msg instanceof Http2DataFrame) {
|
if (msg instanceof Http2DataFrame) {
|
||||||
|
@ -22,7 +22,7 @@ import io.netty.channel.Channel;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.ChannelProgressivePromise;
|
import io.netty.channel.ChannelProgressivePromise;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
@ -106,8 +106,8 @@ final class Http2FrameInboundWriter {
|
|||||||
writer.writeFrame(ctx, frameType, streamId, flags, payload, ctx.newPromise()).syncUninterruptibly();
|
writer.writeFrame(ctx, frameType, streamId, flags, payload, ctx.newPromise()).syncUninterruptibly();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class WriteInboundChannelHandlerContext extends ChannelOutboundHandlerAdapter
|
private static final class WriteInboundChannelHandlerContext
|
||||||
implements ChannelHandlerContext {
|
implements ChannelHandlerContext, ChannelOutboundHandler {
|
||||||
private final EmbeddedChannel channel;
|
private final EmbeddedChannel channel;
|
||||||
|
|
||||||
WriteInboundChannelHandlerContext(EmbeddedChannel channel) {
|
WriteInboundChannelHandlerContext(EmbeddedChannel channel) {
|
||||||
|
@ -25,7 +25,7 @@ import io.netty.channel.ChannelHandler;
|
|||||||
import io.netty.channel.ChannelHandler.Sharable;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
import io.netty.channel.ChannelHandlerAdapter;
|
import io.netty.channel.ChannelHandlerAdapter;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
@ -81,25 +81,25 @@ public class Http2MultiplexCodecBuilderTest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
private boolean writable;
|
private boolean writable;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
writable |= ctx.channel().isWritable();
|
writable |= ctx.channel().isWritable();
|
||||||
super.channelActive(ctx);
|
ctx.fireChannelActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
|
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
|
||||||
writable |= ctx.channel().isWritable();
|
writable |= ctx.channel().isWritable();
|
||||||
super.channelWritabilityChanged(ctx);
|
ctx.fireChannelWritabilityChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
assertTrue(writable);
|
assertTrue(writable);
|
||||||
super.channelInactive(ctx);
|
ctx.fireChannelInactive();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ch.pipeline().addLast(serverLastInboundHandler);
|
ch.pipeline().addLast(serverLastInboundHandler);
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
*/
|
*/
|
||||||
package io.netty.handler.codec.http2;
|
package io.netty.handler.codec.http2;
|
||||||
|
|
||||||
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
@ -28,14 +28,14 @@ import static org.junit.Assert.assertTrue;
|
|||||||
public class Http2MultiplexCodecClientUpgradeTest {
|
public class Http2MultiplexCodecClientUpgradeTest {
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
private final class NoopHandler extends ChannelInboundHandlerAdapter {
|
private final class NoopHandler implements ChannelInboundHandler {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) {
|
public void channelActive(ChannelHandlerContext ctx) {
|
||||||
ctx.channel().close();
|
ctx.channel().close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class UpgradeHandler extends ChannelInboundHandlerAdapter {
|
private final class UpgradeHandler implements ChannelInboundHandler {
|
||||||
Http2Stream.State stateOnActive;
|
Http2Stream.State stateOnActive;
|
||||||
int streamId;
|
int streamId;
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public class Http2MultiplexCodecClientUpgradeTest {
|
|||||||
Http2StreamChannel ch = (Http2StreamChannel) ctx.channel();
|
Http2StreamChannel ch = (Http2StreamChannel) ctx.channel();
|
||||||
stateOnActive = ch.stream().state();
|
stateOnActive = ch.stream().state();
|
||||||
streamId = ch.stream().id();
|
streamId = ch.stream().id();
|
||||||
super.channelActive(ctx);
|
ctx.fireChannelActive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import io.netty.channel.ChannelFuture;
|
|||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.http.HttpMethod;
|
import io.netty.handler.codec.http.HttpMethod;
|
||||||
@ -33,7 +33,6 @@ import io.netty.util.AttributeKey;
|
|||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.ArgumentMatcher;
|
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.invocation.InvocationOnMock;
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
import org.mockito.stubbing.Answer;
|
import org.mockito.stubbing.Answer;
|
||||||
@ -133,7 +132,7 @@ public class Http2MultiplexCodecTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void writeUnknownFrame() {
|
public void writeUnknownFrame() {
|
||||||
Http2StreamChannel childChannel = newOutboundStream(new ChannelInboundHandlerAdapter() {
|
Http2StreamChannel childChannel = newOutboundStream(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) {
|
public void channelActive(ChannelHandlerContext ctx) {
|
||||||
ctx.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers()));
|
ctx.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers()));
|
||||||
@ -157,7 +156,7 @@ public class Http2MultiplexCodecTest {
|
|||||||
AtomicInteger maxReads, final ChannelHandler childHandler) {
|
AtomicInteger maxReads, final ChannelHandler childHandler) {
|
||||||
final AtomicReference<Http2StreamChannel> streamChannelRef = new AtomicReference<>();
|
final AtomicReference<Http2StreamChannel> streamChannelRef = new AtomicReference<>();
|
||||||
childChannelInitializer.maxReads = maxReads;
|
childChannelInitializer.maxReads = maxReads;
|
||||||
childChannelInitializer.handler = new ChannelInboundHandlerAdapter() {
|
childChannelInitializer.handler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRegistered(ChannelHandlerContext ctx) {
|
public void channelRegistered(ChannelHandlerContext ctx) {
|
||||||
assertNull(streamChannelRef.get());
|
assertNull(streamChannelRef.get());
|
||||||
@ -184,7 +183,7 @@ public class Http2MultiplexCodecTest {
|
|||||||
// header frame and unknown frame
|
// header frame and unknown frame
|
||||||
verifyFramesMultiplexedToCorrectChannel(channel, handler, 2);
|
verifyFramesMultiplexedToCorrectChannel(channel, handler, 2);
|
||||||
|
|
||||||
Channel childChannel = newOutboundStream(new ChannelInboundHandlerAdapter());
|
Channel childChannel = newOutboundStream(new ChannelInboundHandler() { });
|
||||||
assertTrue(childChannel.isActive());
|
assertTrue(childChannel.isActive());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +309,7 @@ public class Http2MultiplexCodecTest {
|
|||||||
assertNotNull(headersFrame);
|
assertNotNull(headersFrame);
|
||||||
|
|
||||||
// Add a handler which will request reads.
|
// Add a handler which will request reads.
|
||||||
childChannel.pipeline().addFirst(new ChannelInboundHandlerAdapter() {
|
childChannel.pipeline().addFirst(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
ctx.fireChannelRead(msg);
|
ctx.fireChannelRead(msg);
|
||||||
@ -364,7 +363,7 @@ public class Http2MultiplexCodecTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void outboundStreamShouldWriteResetFrameOnClose_headersSent() {
|
public void outboundStreamShouldWriteResetFrameOnClose_headersSent() {
|
||||||
ChannelHandler handler = new ChannelInboundHandlerAdapter() {
|
ChannelHandler handler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) {
|
public void channelActive(ChannelHandlerContext ctx) {
|
||||||
ctx.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers()));
|
ctx.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers()));
|
||||||
@ -399,7 +398,7 @@ public class Http2MultiplexCodecTest {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Http2StreamChannel childChannel = newOutboundStream(new ChannelInboundHandlerAdapter() {
|
Http2StreamChannel childChannel = newOutboundStream(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) {
|
public void channelActive(ChannelHandlerContext ctx) {
|
||||||
ctx.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers()));
|
ctx.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers()));
|
||||||
@ -630,7 +629,7 @@ public class Http2MultiplexCodecTest {
|
|||||||
public void settingChannelOptsAndAttrs() {
|
public void settingChannelOptsAndAttrs() {
|
||||||
AttributeKey<String> key = AttributeKey.newInstance("foo");
|
AttributeKey<String> key = AttributeKey.newInstance("foo");
|
||||||
|
|
||||||
Channel childChannel = newOutboundStream(new ChannelInboundHandlerAdapter());
|
Channel childChannel = newOutboundStream(new ChannelInboundHandler() { });
|
||||||
childChannel.config().setAutoRead(false).setWriteSpinCount(1000);
|
childChannel.config().setAutoRead(false).setWriteSpinCount(1000);
|
||||||
childChannel.attr(key).set("bar");
|
childChannel.attr(key).set("bar");
|
||||||
assertFalse(childChannel.config().isAutoRead());
|
assertFalse(childChannel.config().isAutoRead());
|
||||||
@ -640,7 +639,7 @@ public class Http2MultiplexCodecTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void outboundFlowControlWritability() {
|
public void outboundFlowControlWritability() {
|
||||||
Http2StreamChannel childChannel = newOutboundStream(new ChannelInboundHandlerAdapter());
|
Http2StreamChannel childChannel = newOutboundStream(new ChannelInboundHandler() { });
|
||||||
assertTrue(childChannel.isActive());
|
assertTrue(childChannel.isActive());
|
||||||
|
|
||||||
assertTrue(childChannel.isWritable());
|
assertTrue(childChannel.isWritable());
|
||||||
@ -692,13 +691,13 @@ public class Http2MultiplexCodecTest {
|
|||||||
assertTrue(childChannel.isOpen());
|
assertTrue(childChannel.isOpen());
|
||||||
assertTrue(childChannel.isActive());
|
assertTrue(childChannel.isActive());
|
||||||
|
|
||||||
childChannel.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
childChannel.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
channelOpen.set(ctx.channel().isOpen());
|
channelOpen.set(ctx.channel().isOpen());
|
||||||
channelActive.set(ctx.channel().isActive());
|
channelActive.set(ctx.channel().isActive());
|
||||||
|
|
||||||
super.channelInactive(ctx);
|
ctx.fireChannelInactive();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -713,7 +712,7 @@ public class Http2MultiplexCodecTest {
|
|||||||
final AtomicInteger exceptionCaught = new AtomicInteger(-1);
|
final AtomicInteger exceptionCaught = new AtomicInteger(-1);
|
||||||
final AtomicInteger channelInactive = new AtomicInteger(-1);
|
final AtomicInteger channelInactive = new AtomicInteger(-1);
|
||||||
final AtomicInteger channelUnregistered = new AtomicInteger(-1);
|
final AtomicInteger channelUnregistered = new AtomicInteger(-1);
|
||||||
Http2StreamChannel childChannel = newOutboundStream(new ChannelInboundHandlerAdapter() {
|
Http2StreamChannel childChannel = newOutboundStream(new ChannelInboundHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
@ -722,24 +721,24 @@ public class Http2MultiplexCodecTest {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
childChannel.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
childChannel.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
channelInactive.set(count.getAndIncrement());
|
channelInactive.set(count.getAndIncrement());
|
||||||
super.channelInactive(ctx);
|
ctx.fireChannelInactive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
exceptionCaught.set(count.getAndIncrement());
|
exceptionCaught.set(count.getAndIncrement());
|
||||||
super.exceptionCaught(ctx, cause);
|
ctx.fireExceptionCaught(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
|
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
|
||||||
channelUnregistered.set(count.getAndIncrement());
|
channelUnregistered.set(count.getAndIncrement());
|
||||||
super.channelUnregistered(ctx);
|
ctx.fireChannelUnregistered();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -785,7 +784,7 @@ public class Http2MultiplexCodecTest {
|
|||||||
|
|
||||||
assertEquals(new DefaultHttp2HeadersFrame(request).stream(childChannel.stream()), inboundHandler.readInbound());
|
assertEquals(new DefaultHttp2HeadersFrame(request).stream(childChannel.stream()), inboundHandler.readInbound());
|
||||||
|
|
||||||
ChannelHandler readCompleteSupressHandler = new ChannelInboundHandlerAdapter() {
|
ChannelHandler readCompleteSupressHandler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelReadComplete(ChannelHandlerContext ctx) {
|
public void channelReadComplete(ChannelHandlerContext ctx) {
|
||||||
// We want to simulate the parent channel calling channelRead and delay calling channelReadComplete.
|
// We want to simulate the parent channel calling channelRead and delay calling channelReadComplete.
|
||||||
@ -848,7 +847,7 @@ public class Http2MultiplexCodecTest {
|
|||||||
|
|
||||||
assertEquals(new DefaultHttp2HeadersFrame(request).stream(childChannel.stream()), inboundHandler.readInbound());
|
assertEquals(new DefaultHttp2HeadersFrame(request).stream(childChannel.stream()), inboundHandler.readInbound());
|
||||||
|
|
||||||
ChannelHandler readCompleteSupressHandler = new ChannelInboundHandlerAdapter() {
|
ChannelHandler readCompleteSupressHandler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelReadComplete(ChannelHandlerContext ctx) {
|
public void channelReadComplete(ChannelHandlerContext ctx) {
|
||||||
// We want to simulate the parent channel calling channelRead and delay calling channelReadComplete.
|
// We want to simulate the parent channel calling channelRead and delay calling channelReadComplete.
|
||||||
@ -908,7 +907,7 @@ public class Http2MultiplexCodecTest {
|
|||||||
|
|
||||||
assertEquals(new DefaultHttp2HeadersFrame(request).stream(childChannel.stream()), inboundHandler.readInbound());
|
assertEquals(new DefaultHttp2HeadersFrame(request).stream(childChannel.stream()), inboundHandler.readInbound());
|
||||||
|
|
||||||
ChannelHandler readCompleteSupressHandler = new ChannelInboundHandlerAdapter() {
|
ChannelHandler readCompleteSupressHandler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
|
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
|
||||||
// We want to simulate the parent channel calling channelRead and delay calling channelReadComplete.
|
// We want to simulate the parent channel calling channelRead and delay calling channelReadComplete.
|
||||||
|
@ -17,7 +17,7 @@ package io.netty.handler.codec.http2;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.http.DefaultFullHttpRequest;
|
import io.netty.handler.codec.http.DefaultFullHttpRequest;
|
||||||
import io.netty.handler.codec.http.DefaultHttpHeaders;
|
import io.netty.handler.codec.http.DefaultHttpHeaders;
|
||||||
@ -57,7 +57,7 @@ public class Http2ServerUpgradeCodecTest {
|
|||||||
request.headers().set(HttpHeaderNames.UPGRADE, "h2c");
|
request.headers().set(HttpHeaderNames.UPGRADE, "h2c");
|
||||||
request.headers().set("HTTP2-Settings", "AAMAAABkAAQAAP__");
|
request.headers().set("HTTP2-Settings", "AAMAAABkAAQAAP__");
|
||||||
|
|
||||||
EmbeddedChannel channel = new EmbeddedChannel(new ChannelInboundHandlerAdapter());
|
EmbeddedChannel channel = new EmbeddedChannel(new ChannelInboundHandler() { });
|
||||||
ChannelHandlerContext ctx = channel.pipeline().firstContext();
|
ChannelHandlerContext ctx = channel.pipeline().firstContext();
|
||||||
Http2ServerUpgradeCodec codec = new Http2ServerUpgradeCodec("connectionHandler", handler);
|
Http2ServerUpgradeCodec codec = new Http2ServerUpgradeCodec("connectionHandler", handler);
|
||||||
assertTrue(codec.prepareUpgradeResponse(ctx, request, new DefaultHttpHeaders()));
|
assertTrue(codec.prepareUpgradeResponse(ctx, request, new DefaultHttpHeaders()));
|
||||||
@ -78,5 +78,5 @@ public class Http2ServerUpgradeCodecTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
private static final class HttpInboundHandler extends ChannelInboundHandlerAdapter { }
|
private static final class HttpInboundHandler implements ChannelInboundHandler { }
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ import io.netty.buffer.ByteBufAllocator;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.handler.codec.EncoderException;
|
import io.netty.handler.codec.EncoderException;
|
||||||
@ -450,7 +450,7 @@ public class Http2StreamFrameToHttpObjectCodecTest {
|
|||||||
|
|
||||||
final SslContext ctx = SslContextBuilder.forClient().sslProvider(SslProvider.JDK).build();
|
final SslContext ctx = SslContextBuilder.forClient().sslProvider(SslProvider.JDK).build();
|
||||||
EmbeddedChannel ch = new EmbeddedChannel(ctx.newHandler(ByteBufAllocator.DEFAULT),
|
EmbeddedChannel ch = new EmbeddedChannel(ctx.newHandler(ByteBufAllocator.DEFAULT),
|
||||||
new ChannelOutboundHandlerAdapter() {
|
new ChannelOutboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
|
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
|
||||||
if (msg instanceof Http2StreamFrame) {
|
if (msg instanceof Http2StreamFrame) {
|
||||||
@ -880,7 +880,7 @@ public class Http2StreamFrameToHttpObjectCodecTest {
|
|||||||
|
|
||||||
final SslContext ctx = SslContextBuilder.forClient().sslProvider(SslProvider.JDK).build();
|
final SslContext ctx = SslContextBuilder.forClient().sslProvider(SslProvider.JDK).build();
|
||||||
EmbeddedChannel tlsCh = new EmbeddedChannel(ctx.newHandler(ByteBufAllocator.DEFAULT),
|
EmbeddedChannel tlsCh = new EmbeddedChannel(ctx.newHandler(ByteBufAllocator.DEFAULT),
|
||||||
new ChannelOutboundHandlerAdapter() {
|
new ChannelOutboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
|
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
|
||||||
if (msg instanceof Http2StreamFrame) {
|
if (msg instanceof Http2StreamFrame) {
|
||||||
@ -893,7 +893,7 @@ public class Http2StreamFrameToHttpObjectCodecTest {
|
|||||||
}, sharedHandler);
|
}, sharedHandler);
|
||||||
|
|
||||||
EmbeddedChannel plaintextCh = new EmbeddedChannel(
|
EmbeddedChannel plaintextCh = new EmbeddedChannel(
|
||||||
new ChannelOutboundHandlerAdapter() {
|
new ChannelOutboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
|
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
|
||||||
if (msg instanceof Http2StreamFrame) {
|
if (msg instanceof Http2StreamFrame) {
|
||||||
|
@ -21,7 +21,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
@ -529,7 +529,7 @@ public class HttpToHttp2ConnectionHandlerTest {
|
|||||||
.gracefulShutdownTimeoutMillis(0)
|
.gracefulShutdownTimeoutMillis(0)
|
||||||
.build();
|
.build();
|
||||||
p.addLast(handler);
|
p.addLast(handler);
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt == Http2ConnectionPrefaceAndSettingsFrameWrittenEvent.INSTANCE) {
|
if (evt == Http2ConnectionPrefaceAndSettingsFrameWrittenEvent.INSTANCE) {
|
||||||
|
@ -21,7 +21,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
@ -665,7 +665,7 @@ public class InboundHttp2ToHttpAdapterTest {
|
|||||||
|
|
||||||
clientDelegator = new HttpResponseDelegator(clientListener, clientLatch, clientLatch2);
|
clientDelegator = new HttpResponseDelegator(clientListener, clientLatch, clientLatch2);
|
||||||
p.addLast(clientDelegator);
|
p.addLast(clientDelegator);
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
Http2Exception e = getEmbeddedHttp2Exception(cause);
|
Http2Exception e = getEmbeddedHttp2Exception(cause);
|
||||||
@ -673,11 +673,11 @@ public class InboundHttp2ToHttpAdapterTest {
|
|||||||
clientException = e;
|
clientException = e;
|
||||||
clientLatch.countDown();
|
clientLatch.countDown();
|
||||||
} else {
|
} else {
|
||||||
super.exceptionCaught(ctx, cause);
|
ctx.fireExceptionCaught(cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt == Http2ConnectionPrefaceAndSettingsFrameWrittenEvent.INSTANCE) {
|
if (evt == Http2ConnectionPrefaceAndSettingsFrameWrittenEvent.INSTANCE) {
|
||||||
prefaceWrittenLatch.countDown();
|
prefaceWrittenLatch.countDown();
|
||||||
|
@ -22,15 +22,16 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.buffer.ByteBufAllocator;
|
import io.netty.buffer.ByteBufAllocator;
|
||||||
import io.netty.buffer.CompositeByteBuf;
|
import io.netty.buffer.CompositeByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
|
import io.netty.channel.ChannelHandlerAdapter;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.socket.ChannelInputShutdownEvent;
|
import io.netty.channel.socket.ChannelInputShutdownEvent;
|
||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link ChannelInboundHandlerAdapter} which decodes bytes in a stream-like fashion from one {@link ByteBuf} to an
|
* {@link ChannelInboundHandler} which decodes bytes in a stream-like fashion from one {@link ByteBuf} to an
|
||||||
* other Message type.
|
* other Message type.
|
||||||
*
|
*
|
||||||
* For example here is an implementation which reads all readable bytes from
|
* For example here is an implementation which reads all readable bytes from
|
||||||
@ -70,7 +71,7 @@ import java.util.List;
|
|||||||
* is not released or added to the <tt>out</tt> {@link List}. Use derived buffers like {@link ByteBuf#readSlice(int)}
|
* is not released or added to the <tt>out</tt> {@link List}. Use derived buffers like {@link ByteBuf#readSlice(int)}
|
||||||
* to avoid leaking memory.
|
* to avoid leaking memory.
|
||||||
*/
|
*/
|
||||||
public abstract class ByteToMessageDecoder extends ChannelInboundHandlerAdapter {
|
public abstract class ByteToMessageDecoder extends ChannelHandlerAdapter implements ChannelInboundHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cumulate {@link ByteBuf}s by merge them into one {@link ByteBuf}'s, using memory copies.
|
* Cumulate {@link ByteBuf}s by merge them into one {@link ByteBuf}'s, using memory copies.
|
||||||
@ -356,7 +357,7 @@ public abstract class ByteToMessageDecoder extends ChannelInboundHandlerAdapter
|
|||||||
// when the input has been shutdown.
|
// when the input has been shutdown.
|
||||||
channelInputClosed(ctx, false);
|
channelInputClosed(ctx, false);
|
||||||
}
|
}
|
||||||
super.userEventTriggered(ctx, evt);
|
ctx.fireUserEventTriggered(evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void channelInputClosed(ChannelHandlerContext ctx, boolean callChannelInactive) throws Exception {
|
private void channelInputClosed(ChannelHandlerContext ctx, boolean callChannelInactive) throws Exception {
|
||||||
|
@ -17,9 +17,9 @@ package io.netty.handler.codec;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
|
import io.netty.channel.ChannelHandlerAdapter;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelOutboundHandler;
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
@ -27,7 +27,7 @@ import io.netty.util.internal.TypeParameterMatcher;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link ChannelOutboundHandlerAdapter} which encodes message in a stream-like fashion from one message to an
|
* {@link ChannelOutboundHandler} which encodes message in a stream-like fashion from one message to an
|
||||||
* {@link ByteBuf}.
|
* {@link ByteBuf}.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -43,7 +43,7 @@ import io.netty.util.internal.TypeParameterMatcher;
|
|||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public abstract class MessageToByteEncoder<I> extends ChannelOutboundHandlerAdapter {
|
public abstract class MessageToByteEncoder<I> extends ChannelHandlerAdapter implements ChannelOutboundHandler {
|
||||||
|
|
||||||
private final TypeParameterMatcher matcher;
|
private final TypeParameterMatcher matcher;
|
||||||
private final boolean preferDirect;
|
private final boolean preferDirect;
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package io.netty.handler.codec;
|
package io.netty.handler.codec;
|
||||||
|
|
||||||
|
import io.netty.channel.ChannelHandlerAdapter;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandler;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
import io.netty.util.ReferenceCounted;
|
import io.netty.util.ReferenceCounted;
|
||||||
@ -26,7 +26,7 @@ import io.netty.util.internal.TypeParameterMatcher;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link ChannelInboundHandlerAdapter} which decodes from one message to an other message.
|
* {@link ChannelInboundHandler} which decodes from one message to an other message.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* For example here is an implementation which decodes a {@link String} to an {@link Integer} which represent
|
* For example here is an implementation which decodes a {@link String} to an {@link Integer} which represent
|
||||||
@ -49,7 +49,7 @@ import java.util.List;
|
|||||||
* {@link ReferenceCounted#release()} on decoded messages.
|
* {@link ReferenceCounted#release()} on decoded messages.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class MessageToMessageDecoder<I> extends ChannelInboundHandlerAdapter {
|
public abstract class MessageToMessageDecoder<I> extends ChannelHandlerAdapter implements ChannelInboundHandler {
|
||||||
|
|
||||||
private final TypeParameterMatcher matcher;
|
private final TypeParameterMatcher matcher;
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package io.netty.handler.codec;
|
package io.netty.handler.codec;
|
||||||
|
|
||||||
|
import io.netty.channel.ChannelHandlerAdapter;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelOutboundHandler;
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
@ -29,7 +29,7 @@ import io.netty.util.internal.TypeParameterMatcher;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link ChannelOutboundHandlerAdapter} which encodes from one message to an other message
|
* {@link ChannelOutboundHandler} which encodes from one message to an other message
|
||||||
*
|
*
|
||||||
* For example here is an implementation which decodes an {@link Integer} to an {@link String}.
|
* For example here is an implementation which decodes an {@link Integer} to an {@link String}.
|
||||||
*
|
*
|
||||||
@ -49,7 +49,7 @@ import java.util.List;
|
|||||||
* are of type {@link ReferenceCounted}. This is needed as the {@link MessageToMessageEncoder} will call
|
* are of type {@link ReferenceCounted}. This is needed as the {@link MessageToMessageEncoder} will call
|
||||||
* {@link ReferenceCounted#release()} on encoded messages.
|
* {@link ReferenceCounted#release()} on encoded messages.
|
||||||
*/
|
*/
|
||||||
public abstract class MessageToMessageEncoder<I> extends ChannelOutboundHandlerAdapter {
|
public abstract class MessageToMessageEncoder<I> extends ChannelHandlerAdapter implements ChannelOutboundHandler {
|
||||||
|
|
||||||
private final TypeParameterMatcher matcher;
|
private final TypeParameterMatcher matcher;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.buffer.UnpooledByteBufAllocator;
|
import io.netty.buffer.UnpooledByteBufAllocator;
|
||||||
import io.netty.buffer.UnpooledHeapByteBuf;
|
import io.netty.buffer.UnpooledHeapByteBuf;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ public class ByteToMessageDecoderTest {
|
|||||||
assertFalse(in.isReadable());
|
assertFalse(in.isReadable());
|
||||||
out.add("data");
|
out.add("data");
|
||||||
}
|
}
|
||||||
}, new ChannelInboundHandlerAdapter() {
|
}, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) {
|
public void channelInactive(ChannelHandlerContext ctx) {
|
||||||
queue.add(3);
|
queue.add(3);
|
||||||
@ -212,7 +212,7 @@ public class ByteToMessageDecoderTest {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
EmbeddedChannel channel = new EmbeddedChannel(decoder, new ChannelInboundHandlerAdapter() {
|
EmbeddedChannel channel = new EmbeddedChannel(decoder, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
if (msg == upgradeMessage) {
|
if (msg == upgradeMessage) {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package io.netty.handler.codec;
|
package io.netty.handler.codec;
|
||||||
|
|
||||||
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
@ -26,12 +27,11 @@ import io.netty.buffer.ByteBufHolder;
|
|||||||
import io.netty.buffer.DefaultByteBufHolder;
|
import io.netty.buffer.DefaultByteBufHolder;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.util.CharsetUtil;
|
import io.netty.util.CharsetUtil;
|
||||||
|
|
||||||
public class MessageAggregatorTest {
|
public class MessageAggregatorTest {
|
||||||
private static final class ReadCounter extends ChannelOutboundHandlerAdapter {
|
private static final class ReadCounter implements ChannelOutboundHandler {
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,7 +18,7 @@ package io.netty.handler.codec;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -55,7 +55,7 @@ public class MessageToMessageEncoderTest {
|
|||||||
|
|
||||||
final Exception firstWriteException = new Exception();
|
final Exception firstWriteException = new Exception();
|
||||||
|
|
||||||
ChannelHandler writeThrower = new ChannelOutboundHandlerAdapter() {
|
ChannelHandler writeThrower = new ChannelOutboundHandler() {
|
||||||
private boolean firstWritten;
|
private boolean firstWritten;
|
||||||
@Override
|
@Override
|
||||||
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
|
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
|
||||||
|
@ -18,7 +18,7 @@ package io.netty.handler.codec;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.channel.socket.ChannelInputShutdownEvent;
|
import io.netty.channel.socket.ChannelInputShutdownEvent;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -96,7 +96,7 @@ public class ReplayingDecoderTest {
|
|||||||
assertNull(ch.readInbound());
|
assertNull(ch.readInbound());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class BloatedLineDecoder extends ChannelInboundHandlerAdapter {
|
private static final class BloatedLineDecoder implements ChannelInboundHandler {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
ctx.pipeline().replace(this, "less-bloated", new LineDecoder());
|
ctx.pipeline().replace(this, "less-bloated", new LineDecoder());
|
||||||
@ -226,7 +226,7 @@ public class ReplayingDecoderTest {
|
|||||||
assertFalse(in.isReadable());
|
assertFalse(in.isReadable());
|
||||||
out.add("data");
|
out.add("data");
|
||||||
}
|
}
|
||||||
}, new ChannelInboundHandlerAdapter() {
|
}, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
queue.add(3);
|
queue.add(3);
|
||||||
|
@ -18,14 +18,14 @@ package io.netty.example.echo;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler implementation for the echo client. It initiates the ping-pong
|
* Handler implementation for the echo client. It initiates the ping-pong
|
||||||
* traffic between the echo client and server by sending the first message to
|
* traffic between the echo client and server by sending the first message to
|
||||||
* the server.
|
* the server.
|
||||||
*/
|
*/
|
||||||
public class EchoClientHandler extends ChannelInboundHandlerAdapter {
|
public class EchoClientHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private final ByteBuf firstMessage;
|
private final ByteBuf firstMessage;
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@ package io.netty.example.echo;
|
|||||||
|
|
||||||
import io.netty.channel.ChannelHandler.Sharable;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler implementation for the echo server.
|
* Handler implementation for the echo server.
|
||||||
*/
|
*/
|
||||||
@Sharable
|
@Sharable
|
||||||
public class EchoServerHandler extends ChannelInboundHandlerAdapter {
|
public class EchoServerHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
package io.netty.example.http2.helloworld.client;
|
package io.netty.example.http2.helloworld.client;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.socket.SocketChannel;
|
import io.netty.channel.socket.SocketChannel;
|
||||||
@ -129,7 +129,7 @@ public class Http2ClientInitializer extends ChannelInitializer<SocketChannel> {
|
|||||||
/**
|
/**
|
||||||
* A handler that triggers the cleartext upgrade to HTTP/2 by sending an initial HTTP request.
|
* A handler that triggers the cleartext upgrade to HTTP/2 by sending an initial HTTP request.
|
||||||
*/
|
*/
|
||||||
private final class UpgradeRequestHandler extends ChannelInboundHandlerAdapter {
|
private final class UpgradeRequestHandler implements ChannelInboundHandler {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
DefaultFullHttpRequest upgradeRequest =
|
DefaultFullHttpRequest upgradeRequest =
|
||||||
@ -148,7 +148,7 @@ public class Http2ClientInitializer extends ChannelInitializer<SocketChannel> {
|
|||||||
/**
|
/**
|
||||||
* Class that logs any User Events triggered on this channel.
|
* Class that logs any User Events triggered on this channel.
|
||||||
*/
|
*/
|
||||||
private static class UserEventLogger extends ChannelInboundHandlerAdapter {
|
private static class UserEventLogger implements ChannelInboundHandler {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
System.out.println("User Event Triggered: " + evt);
|
System.out.println("User Event Triggered: " + evt);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.netty.example.http2.helloworld.frame.server;
|
package io.netty.example.http2.helloworld.frame.server;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
@ -27,7 +27,6 @@ import io.netty.handler.codec.http.HttpMessage;
|
|||||||
import io.netty.handler.codec.http.HttpObjectAggregator;
|
import io.netty.handler.codec.http.HttpObjectAggregator;
|
||||||
import io.netty.handler.codec.http.HttpServerCodec;
|
import io.netty.handler.codec.http.HttpServerCodec;
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler;
|
import io.netty.handler.codec.http.HttpServerUpgradeHandler;
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodec;
|
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodecFactory;
|
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodecFactory;
|
||||||
import io.netty.handler.codec.http2.Http2CodecUtil;
|
import io.netty.handler.codec.http2.Http2CodecUtil;
|
||||||
import io.netty.handler.codec.http2.Http2FrameCodecBuilder;
|
import io.netty.handler.codec.http2.Http2FrameCodecBuilder;
|
||||||
@ -110,7 +109,7 @@ public class Http2ServerInitializer extends ChannelInitializer<SocketChannel> {
|
|||||||
/**
|
/**
|
||||||
* Class that logs any User Events triggered on this channel.
|
* Class that logs any User Events triggered on this channel.
|
||||||
*/
|
*/
|
||||||
private static class UserEventLogger extends ChannelInboundHandlerAdapter {
|
private static class UserEventLogger implements ChannelInboundHandler {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||||
System.out.println("User Event Triggered: " + evt);
|
System.out.println("User Event Triggered: " + evt);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.netty.example.http2.helloworld.multiplex.server;
|
package io.netty.example.http2.helloworld.multiplex.server;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
@ -27,7 +27,6 @@ import io.netty.handler.codec.http.HttpMessage;
|
|||||||
import io.netty.handler.codec.http.HttpObjectAggregator;
|
import io.netty.handler.codec.http.HttpObjectAggregator;
|
||||||
import io.netty.handler.codec.http.HttpServerCodec;
|
import io.netty.handler.codec.http.HttpServerCodec;
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler;
|
import io.netty.handler.codec.http.HttpServerUpgradeHandler;
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodec;
|
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodecFactory;
|
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodecFactory;
|
||||||
import io.netty.handler.codec.http2.Http2MultiplexCodecBuilder;
|
import io.netty.handler.codec.http2.Http2MultiplexCodecBuilder;
|
||||||
import io.netty.handler.codec.http2.Http2CodecUtil;
|
import io.netty.handler.codec.http2.Http2CodecUtil;
|
||||||
@ -110,7 +109,7 @@ public class Http2ServerInitializer extends ChannelInitializer<SocketChannel> {
|
|||||||
/**
|
/**
|
||||||
* Class that logs any User Events triggered on this channel.
|
* Class that logs any User Events triggered on this channel.
|
||||||
*/
|
*/
|
||||||
private static class UserEventLogger extends ChannelInboundHandlerAdapter {
|
private static class UserEventLogger implements ChannelInboundHandler {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||||
System.out.println("User Event Triggered: " + evt);
|
System.out.println("User Event Triggered: " + evt);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package io.netty.example.http2.helloworld.server;
|
package io.netty.example.http2.helloworld.server;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
@ -26,7 +26,6 @@ import io.netty.handler.codec.http.HttpMessage;
|
|||||||
import io.netty.handler.codec.http.HttpObjectAggregator;
|
import io.netty.handler.codec.http.HttpObjectAggregator;
|
||||||
import io.netty.handler.codec.http.HttpServerCodec;
|
import io.netty.handler.codec.http.HttpServerCodec;
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler;
|
import io.netty.handler.codec.http.HttpServerUpgradeHandler;
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodec;
|
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodecFactory;
|
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodecFactory;
|
||||||
import io.netty.handler.codec.http2.CleartextHttp2ServerUpgradeHandler;
|
import io.netty.handler.codec.http2.CleartextHttp2ServerUpgradeHandler;
|
||||||
import io.netty.handler.codec.http2.Http2CodecUtil;
|
import io.netty.handler.codec.http2.Http2CodecUtil;
|
||||||
@ -111,7 +110,7 @@ public class Http2ServerInitializer extends ChannelInitializer<SocketChannel> {
|
|||||||
/**
|
/**
|
||||||
* Class that logs any User Events triggered on this channel.
|
* Class that logs any User Events triggered on this channel.
|
||||||
*/
|
*/
|
||||||
private static class UserEventLogger extends ChannelInboundHandlerAdapter {
|
private static class UserEventLogger implements ChannelInboundHandler {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||||
System.out.println("User Event Triggered: " + evt);
|
System.out.println("User Event Triggered: " + evt);
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
package io.netty.example.localecho;
|
package io.netty.example.localecho;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
|
|
||||||
public class LocalEchoServerHandler extends ChannelInboundHandlerAdapter {
|
public class LocalEchoServerHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
package io.netty.example.objectecho;
|
package io.netty.example.objectecho;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -26,7 +26,7 @@ import java.util.List;
|
|||||||
* ping-pong traffic between the object echo client and server by sending the
|
* ping-pong traffic between the object echo client and server by sending the
|
||||||
* first message to the server.
|
* first message to the server.
|
||||||
*/
|
*/
|
||||||
public class ObjectEchoClientHandler extends ChannelInboundHandlerAdapter {
|
public class ObjectEchoClientHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private final List<Integer> firstMessage;
|
private final List<Integer> firstMessage;
|
||||||
|
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
package io.netty.example.objectecho;
|
package io.netty.example.objectecho;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles both client-side and server-side handler depending on which
|
* Handles both client-side and server-side handler depending on which
|
||||||
* constructor was called.
|
* constructor was called.
|
||||||
*/
|
*/
|
||||||
public class ObjectEchoServerHandler extends ChannelInboundHandlerAdapter {
|
public class ObjectEchoServerHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
|
@ -21,6 +21,7 @@ import java.math.BigInteger;
|
|||||||
import javax.net.ssl.SSLSession;
|
import javax.net.ssl.SSLSession;
|
||||||
import javax.security.cert.X509Certificate;
|
import javax.security.cert.X509Certificate;
|
||||||
|
|
||||||
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
import io.netty.channel.nio.NioHandler;
|
import io.netty.channel.nio.NioHandler;
|
||||||
import org.bouncycastle.asn1.ocsp.OCSPResponseStatus;
|
import org.bouncycastle.asn1.ocsp.OCSPResponseStatus;
|
||||||
@ -33,7 +34,6 @@ import io.netty.bootstrap.Bootstrap;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
@ -152,7 +152,7 @@ public class OcspClientExample {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class HttpClientHandler extends ChannelInboundHandlerAdapter {
|
private static class HttpClientHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private final String host;
|
private final String host;
|
||||||
|
|
||||||
|
@ -16,12 +16,11 @@
|
|||||||
package io.netty.example.proxy;
|
package io.netty.example.proxy;
|
||||||
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
|
|
||||||
public class HexDumpProxyBackendHandler extends ChannelInboundHandlerAdapter {
|
public class HexDumpProxyBackendHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private final Channel inboundChannel;
|
private final Channel inboundChannel;
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ import io.netty.channel.Channel;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
|
|
||||||
public class HexDumpProxyFrontendHandler extends ChannelInboundHandlerAdapter {
|
public class HexDumpProxyFrontendHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private final String remoteHost;
|
private final String remoteHost;
|
||||||
private final int remotePort;
|
private final int remotePort;
|
||||||
|
@ -18,7 +18,7 @@ package io.netty.example.sctp;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.sctp.SctpMessage;
|
import io.netty.channel.sctp.SctpMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,7 +26,7 @@ import io.netty.channel.sctp.SctpMessage;
|
|||||||
* traffic between the echo client and server by sending the first message to
|
* traffic between the echo client and server by sending the first message to
|
||||||
* the server.
|
* the server.
|
||||||
*/
|
*/
|
||||||
public class SctpEchoClientHandler extends ChannelInboundHandlerAdapter {
|
public class SctpEchoClientHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private final ByteBuf firstMessage;
|
private final ByteBuf firstMessage;
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@ package io.netty.example.sctp;
|
|||||||
|
|
||||||
import io.netty.channel.ChannelHandler.Sharable;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler implementation for the SCTP echo server.
|
* Handler implementation for the SCTP echo server.
|
||||||
*/
|
*/
|
||||||
@Sharable
|
@Sharable
|
||||||
public class SctpEchoServerHandler extends ChannelInboundHandlerAdapter {
|
public class SctpEchoServerHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
|
@ -17,10 +17,10 @@ package io.netty.example.socksproxy;
|
|||||||
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.util.concurrent.Promise;
|
import io.netty.util.concurrent.Promise;
|
||||||
|
|
||||||
public final class DirectClientHandler extends ChannelInboundHandlerAdapter {
|
public final class DirectClientHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private final Promise<Channel> promise;
|
private final Promise<Channel> promise;
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ package io.netty.example.socksproxy;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
|
|
||||||
public final class RelayHandler extends ChannelInboundHandlerAdapter {
|
public final class RelayHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private final Channel relayChannel;
|
private final Channel relayChannel;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import io.netty.bootstrap.ServerBootstrap;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
@ -186,7 +186,7 @@ public class HttpProxyHandlerTest {
|
|||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) {
|
protected void initChannel(Channel ch) {
|
||||||
ch.pipeline().addFirst(new HttpResponseEncoder());
|
ch.pipeline().addFirst(new HttpResponseEncoder());
|
||||||
ch.pipeline().addFirst(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addFirst(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) {
|
public void channelActive(ChannelHandlerContext ctx) {
|
||||||
DefaultFullHttpResponse response = new DefaultFullHttpResponse(
|
DefaultFullHttpResponse response = new DefaultFullHttpResponse(
|
||||||
@ -205,7 +205,7 @@ public class HttpProxyHandlerTest {
|
|||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) {
|
protected void initChannel(Channel ch) {
|
||||||
ch.pipeline().addFirst(new HttpProxyHandler(addr));
|
ch.pipeline().addFirst(new HttpProxyHandler(addr));
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx,
|
public void exceptionCaught(ChannelHandlerContext ctx,
|
||||||
Throwable cause) {
|
Throwable cause) {
|
||||||
|
@ -25,7 +25,7 @@ import io.netty.channel.ChannelFuture;
|
|||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.EventLoop;
|
import io.netty.channel.EventLoop;
|
||||||
@ -229,7 +229,7 @@ abstract class ProxyServer {
|
|||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class BackendHandler extends ChannelInboundHandlerAdapter {
|
private final class BackendHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private final ChannelHandlerContext frontend;
|
private final ChannelHandlerContext frontend;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import io.netty.channel.Channel;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
|
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ import java.net.SocketAddress;
|
|||||||
* flexibility to respond to rejected (denied) connections. If you do not want to send a response, just have it return
|
* flexibility to respond to rejected (denied) connections. If you do not want to send a response, just have it return
|
||||||
* null. Take a look at {@link RuleBasedIpFilter} for details.
|
* null. Take a look at {@link RuleBasedIpFilter} for details.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractRemoteAddressFilter<T extends SocketAddress> extends ChannelInboundHandlerAdapter {
|
public abstract class AbstractRemoteAddressFilter<T extends SocketAddress> implements ChannelInboundHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
|
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
@ -19,7 +19,7 @@ import static java.util.Objects.requireNonNull;
|
|||||||
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.util.internal.logging.InternalLogger;
|
import io.netty.util.internal.logging.InternalLogger;
|
||||||
@ -60,7 +60,7 @@ import io.netty.util.internal.logging.InternalLoggerFactory;
|
|||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public abstract class ApplicationProtocolNegotiationHandler extends ChannelInboundHandlerAdapter {
|
public abstract class ApplicationProtocolNegotiationHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private static final InternalLogger logger =
|
private static final InternalLogger logger =
|
||||||
InternalLoggerFactory.getInstance(ApplicationProtocolNegotiationHandler.class);
|
InternalLoggerFactory.getInstance(ApplicationProtocolNegotiationHandler.class);
|
||||||
|
@ -18,7 +18,7 @@ package io.netty.handler.ssl.ocsp;
|
|||||||
import static java.util.Objects.requireNonNull;
|
import static java.util.Objects.requireNonNull;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.handler.ssl.ReferenceCountedOpenSslContext;
|
import io.netty.handler.ssl.ReferenceCountedOpenSslContext;
|
||||||
import io.netty.handler.ssl.ReferenceCountedOpenSslEngine;
|
import io.netty.handler.ssl.ReferenceCountedOpenSslEngine;
|
||||||
import io.netty.handler.ssl.SslHandshakeCompletionEvent;
|
import io.netty.handler.ssl.SslHandshakeCompletionEvent;
|
||||||
@ -34,7 +34,7 @@ import javax.net.ssl.SSLHandshakeException;
|
|||||||
* @see ReferenceCountedOpenSslEngine#getOcspResponse()
|
* @see ReferenceCountedOpenSslEngine#getOcspResponse()
|
||||||
*/
|
*/
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public abstract class OcspClientHandler extends ChannelInboundHandlerAdapter {
|
public abstract class OcspClientHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private static final SSLHandshakeException OCSP_VERIFICATION_EXCEPTION = ThrowableUtil.unknownStackTrace(
|
private static final SSLHandshakeException OCSP_VERIFICATION_EXCEPTION = ThrowableUtil.unknownStackTrace(
|
||||||
new SSLHandshakeException("Bad OCSP response"), OcspClientHandler.class, "verify(...)");
|
new SSLHandshakeException("Bad OCSP response"), OcspClientHandler.class, "verify(...)");
|
||||||
|
@ -24,7 +24,7 @@ import io.netty.channel.ChannelFuture;
|
|||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
|
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
@ -64,7 +64,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* @see ReadTimeoutHandler
|
* @see ReadTimeoutHandler
|
||||||
* @see IdleStateHandler
|
* @see IdleStateHandler
|
||||||
*/
|
*/
|
||||||
public class WriteTimeoutHandler extends ChannelOutboundHandlerAdapter {
|
public class WriteTimeoutHandler implements ChannelOutboundHandler {
|
||||||
private static final long MIN_TIMEOUT_NANOS = TimeUnit.MILLISECONDS.toNanos(1);
|
private static final long MIN_TIMEOUT_NANOS = TimeUnit.MILLISECONDS.toNanos(1);
|
||||||
|
|
||||||
private final long timeoutNanos;
|
private final long timeoutNanos;
|
||||||
|
@ -21,10 +21,9 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelConfig;
|
import io.netty.channel.ChannelConfig;
|
||||||
import io.netty.channel.ChannelDuplexHandler;
|
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
@ -95,7 +94,7 @@ public class FlowControlHandlerTest {
|
|||||||
bootstrap.group(GROUP)
|
bootstrap.group(GROUP)
|
||||||
.channel(NioSocketChannel.class)
|
.channel(NioSocketChannel.class)
|
||||||
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000)
|
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000)
|
||||||
.handler(new ChannelInboundHandlerAdapter() {
|
.handler(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
fail("In this test the client is never receiving a message from the server.");
|
fail("In this test the client is never receiving a message from the server.");
|
||||||
@ -120,7 +119,7 @@ public class FlowControlHandlerTest {
|
|||||||
public void testAutoReadingOn() throws Exception {
|
public void testAutoReadingOn() throws Exception {
|
||||||
final CountDownLatch latch = new CountDownLatch(3);
|
final CountDownLatch latch = new CountDownLatch(3);
|
||||||
|
|
||||||
ChannelInboundHandlerAdapter handler = new ChannelInboundHandlerAdapter() {
|
ChannelInboundHandler handler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
ReferenceCountUtil.release(msg);
|
ReferenceCountUtil.release(msg);
|
||||||
@ -162,7 +161,7 @@ public class FlowControlHandlerTest {
|
|||||||
final Exchanger<Channel> peerRef = new Exchanger<>();
|
final Exchanger<Channel> peerRef = new Exchanger<>();
|
||||||
final CountDownLatch latch = new CountDownLatch(3);
|
final CountDownLatch latch = new CountDownLatch(3);
|
||||||
|
|
||||||
ChannelInboundHandlerAdapter handler = new ChannelInboundHandlerAdapter() {
|
ChannelInboundHandler handler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
peerRef.exchange(ctx.channel(), 1L, SECONDS);
|
peerRef.exchange(ctx.channel(), 1L, SECONDS);
|
||||||
@ -208,7 +207,7 @@ public class FlowControlHandlerTest {
|
|||||||
public void testFlowAutoReadOn() throws Exception {
|
public void testFlowAutoReadOn() throws Exception {
|
||||||
final CountDownLatch latch = new CountDownLatch(3);
|
final CountDownLatch latch = new CountDownLatch(3);
|
||||||
|
|
||||||
ChannelInboundHandlerAdapter handler = new ChannelDuplexHandler() {
|
ChannelInboundHandler handler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
@ -245,7 +244,7 @@ public class FlowControlHandlerTest {
|
|||||||
final CountDownLatch setAutoReadLatch1 = new CountDownLatch(1);
|
final CountDownLatch setAutoReadLatch1 = new CountDownLatch(1);
|
||||||
final CountDownLatch setAutoReadLatch2 = new CountDownLatch(1);
|
final CountDownLatch setAutoReadLatch2 = new CountDownLatch(1);
|
||||||
|
|
||||||
ChannelInboundHandlerAdapter handler = new ChannelInboundHandlerAdapter() {
|
ChannelInboundHandler handler = new ChannelInboundHandler() {
|
||||||
private int msgRcvCount;
|
private int msgRcvCount;
|
||||||
private int expectedMsgCount;
|
private int expectedMsgCount;
|
||||||
@Override
|
@Override
|
||||||
@ -325,7 +324,7 @@ public class FlowControlHandlerTest {
|
|||||||
final CountDownLatch msgRcvLatch2 = new CountDownLatch(2);
|
final CountDownLatch msgRcvLatch2 = new CountDownLatch(2);
|
||||||
final CountDownLatch msgRcvLatch3 = new CountDownLatch(3);
|
final CountDownLatch msgRcvLatch3 = new CountDownLatch(3);
|
||||||
|
|
||||||
ChannelInboundHandlerAdapter handler = new ChannelDuplexHandler() {
|
ChannelInboundHandler handler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
ctx.fireChannelActive();
|
ctx.fireChannelActive();
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
package io.netty.handler.flush;
|
package io.netty.handler.flush;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ public class FlushConsolidationHandlerTest {
|
|||||||
|
|
||||||
private static EmbeddedChannel newChannel(final AtomicInteger flushCount, boolean consolidateWhenNoReadInProgress) {
|
private static EmbeddedChannel newChannel(final AtomicInteger flushCount, boolean consolidateWhenNoReadInProgress) {
|
||||||
return new EmbeddedChannel(
|
return new EmbeddedChannel(
|
||||||
new ChannelOutboundHandlerAdapter() {
|
new ChannelOutboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void flush(ChannelHandlerContext ctx) throws Exception {
|
public void flush(ChannelHandlerContext ctx) throws Exception {
|
||||||
flushCount.incrementAndGet();
|
flushCount.incrementAndGet();
|
||||||
@ -162,7 +162,7 @@ public class FlushConsolidationHandlerTest {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FlushConsolidationHandler(EXPLICIT_FLUSH_AFTER_FLUSHES, consolidateWhenNoReadInProgress),
|
new FlushConsolidationHandler(EXPLICIT_FLUSH_AFTER_FLUSHES, consolidateWhenNoReadInProgress),
|
||||||
new ChannelInboundHandlerAdapter() {
|
new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
ctx.writeAndFlush(msg);
|
ctx.writeAndFlush(msg);
|
||||||
|
@ -20,10 +20,9 @@ import io.netty.bootstrap.ServerBootstrap;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.CompositeByteBuf;
|
import io.netty.buffer.CompositeByteBuf;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
@ -35,7 +34,6 @@ import io.netty.handler.ssl.util.SelfSignedCertificate;
|
|||||||
import io.netty.handler.ssl.util.SimpleTrustManagerFactory;
|
import io.netty.handler.ssl.util.SimpleTrustManagerFactory;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
import io.netty.util.internal.ResourcesUtil;
|
import io.netty.util.internal.ResourcesUtil;
|
||||||
import io.netty.util.concurrent.Future;
|
|
||||||
import io.netty.util.concurrent.FutureListener;
|
import io.netty.util.concurrent.FutureListener;
|
||||||
import io.netty.util.concurrent.Promise;
|
import io.netty.util.concurrent.Promise;
|
||||||
import io.netty.util.concurrent.PromiseNotifier;
|
import io.netty.util.concurrent.PromiseNotifier;
|
||||||
@ -154,7 +152,7 @@ public class ParameterizedSslHandlerTest {
|
|||||||
handler.setWrapDataSize(-1);
|
handler.setWrapDataSize(-1);
|
||||||
}
|
}
|
||||||
ch.pipeline().addLast(handler);
|
ch.pipeline().addLast(handler);
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
private boolean sentData;
|
private boolean sentData;
|
||||||
private Throwable writeCause;
|
private Throwable writeCause;
|
||||||
|
|
||||||
@ -208,7 +206,7 @@ public class ParameterizedSslHandlerTest {
|
|||||||
} else {
|
} else {
|
||||||
ch.pipeline().addLast(new SslHandler(sslClientCtx.newEngine(ch.alloc())));
|
ch.pipeline().addLast(new SslHandler(sslClientCtx.newEngine(ch.alloc())));
|
||||||
}
|
}
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
private int bytesSeen;
|
private int bytesSeen;
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
@ -316,7 +314,7 @@ public class ParameterizedSslHandlerTest {
|
|||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(sslServerCtx.newHandler(ch.alloc()));
|
ch.pipeline().addLast(sslServerCtx.newHandler(ch.alloc()));
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
// Just trigger a close
|
// Just trigger a close
|
||||||
@ -333,7 +331,7 @@ public class ParameterizedSslHandlerTest {
|
|||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(sslClientCtx.newHandler(ch.alloc()));
|
ch.pipeline().addLast(sslClientCtx.newHandler(ch.alloc()));
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
if (cause.getCause() instanceof SSLException) {
|
if (cause.getCause() instanceof SSLException) {
|
||||||
@ -430,7 +428,7 @@ public class ParameterizedSslHandlerTest {
|
|||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
final AtomicBoolean closeSent = new AtomicBoolean();
|
final AtomicBoolean closeSent = new AtomicBoolean();
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
ch.pipeline().addFirst(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addFirst(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
if (closeSent.get()) {
|
if (closeSent.get()) {
|
||||||
@ -438,7 +436,7 @@ public class ParameterizedSslHandlerTest {
|
|||||||
// close_notify.
|
// close_notify.
|
||||||
ReferenceCountUtil.release(msg);
|
ReferenceCountUtil.release(msg);
|
||||||
} else {
|
} else {
|
||||||
super.channelRead(ctx, msg);
|
ctx.fireChannelRead(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@ import io.netty.bootstrap.Bootstrap;
|
|||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
@ -30,7 +30,6 @@ import io.netty.channel.local.LocalServerChannel;
|
|||||||
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
|
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
|
||||||
import io.netty.handler.ssl.util.SelfSignedCertificate;
|
import io.netty.handler.ssl.util.SelfSignedCertificate;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
import io.netty.util.concurrent.Future;
|
|
||||||
import io.netty.util.concurrent.FutureListener;
|
import io.netty.util.concurrent.FutureListener;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -54,7 +53,7 @@ public abstract class RenegotiateTest {
|
|||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(context.newHandler(ch.alloc()));
|
ch.pipeline().addLast(context.newHandler(ch.alloc()));
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
private boolean renegotiate;
|
private boolean renegotiate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -101,7 +100,7 @@ public abstract class RenegotiateTest {
|
|||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(clientContext.newHandler(ch.alloc()));
|
ch.pipeline().addLast(clientContext.newHandler(ch.alloc()));
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(
|
public void userEventTriggered(
|
||||||
ChannelHandlerContext ctx, Object evt) throws Exception {
|
ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
|
@ -25,7 +25,7 @@ import io.netty.buffer.UnpooledByteBufAllocator;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
@ -740,7 +740,7 @@ public abstract class SSLEngineTest {
|
|||||||
}
|
}
|
||||||
p.addLast(handler);
|
p.addLast(handler);
|
||||||
p.addLast(new MessageDelegatorChannelHandler(serverReceiver, serverLatch));
|
p.addLast(new MessageDelegatorChannelHandler(serverReceiver, serverLatch));
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt == SslHandshakeCompletionEvent.SUCCESS) {
|
if (evt == SslHandshakeCompletionEvent.SUCCESS) {
|
||||||
@ -782,7 +782,7 @@ public abstract class SSLEngineTest {
|
|||||||
clientSslCtx.newHandler(ch.alloc(), delegatingExecutor);
|
clientSslCtx.newHandler(ch.alloc(), delegatingExecutor);
|
||||||
p.addLast(handler);
|
p.addLast(handler);
|
||||||
p.addLast(new MessageDelegatorChannelHandler(clientReceiver, clientLatch));
|
p.addLast(new MessageDelegatorChannelHandler(clientReceiver, clientLatch));
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt == SslHandshakeCompletionEvent.SUCCESS) {
|
if (evt == SslHandshakeCompletionEvent.SUCCESS) {
|
||||||
@ -889,7 +889,7 @@ public abstract class SSLEngineTest {
|
|||||||
serverSslCtx.newHandler(ch.alloc(), delegatingExecutor);
|
serverSslCtx.newHandler(ch.alloc(), delegatingExecutor);
|
||||||
p.addLast(handler);
|
p.addLast(handler);
|
||||||
p.addLast(new MessageDelegatorChannelHandler(serverReceiver, serverLatch));
|
p.addLast(new MessageDelegatorChannelHandler(serverReceiver, serverLatch));
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt == SslHandshakeCompletionEvent.SUCCESS) {
|
if (evt == SslHandshakeCompletionEvent.SUCCESS) {
|
||||||
@ -941,7 +941,7 @@ public abstract class SSLEngineTest {
|
|||||||
sslHandler.engine().setSSLParameters(parameters);
|
sslHandler.engine().setSSLParameters(parameters);
|
||||||
p.addLast(sslHandler);
|
p.addLast(sslHandler);
|
||||||
p.addLast(new MessageDelegatorChannelHandler(clientReceiver, clientLatch));
|
p.addLast(new MessageDelegatorChannelHandler(clientReceiver, clientLatch));
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt == SslHandshakeCompletionEvent.SUCCESS) {
|
if (evt == SslHandshakeCompletionEvent.SUCCESS) {
|
||||||
@ -1061,7 +1061,7 @@ public abstract class SSLEngineTest {
|
|||||||
|
|
||||||
p.addLast(new SslHandler(engine));
|
p.addLast(new SslHandler(engine));
|
||||||
p.addLast(new MessageDelegatorChannelHandler(serverReceiver, serverLatch));
|
p.addLast(new MessageDelegatorChannelHandler(serverReceiver, serverLatch));
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
if (cause.getCause() instanceof SSLHandshakeException) {
|
if (cause.getCause() instanceof SSLHandshakeException) {
|
||||||
@ -1104,7 +1104,7 @@ public abstract class SSLEngineTest {
|
|||||||
ChannelPipeline p = ch.pipeline();
|
ChannelPipeline p = ch.pipeline();
|
||||||
p.addLast(handler);
|
p.addLast(handler);
|
||||||
p.addLast(new MessageDelegatorChannelHandler(clientReceiver, clientLatch));
|
p.addLast(new MessageDelegatorChannelHandler(clientReceiver, clientLatch));
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt == SslHandshakeCompletionEvent.SUCCESS) {
|
if (evt == SslHandshakeCompletionEvent.SUCCESS) {
|
||||||
@ -1300,7 +1300,7 @@ public abstract class SSLEngineTest {
|
|||||||
serverSslCtx.newHandler(ch.alloc(), delegatingExecutor);
|
serverSslCtx.newHandler(ch.alloc(), delegatingExecutor);
|
||||||
|
|
||||||
p.addLast(handler);
|
p.addLast(handler);
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||||
if (evt instanceof SslHandshakeCompletionEvent &&
|
if (evt instanceof SslHandshakeCompletionEvent &&
|
||||||
@ -1361,7 +1361,7 @@ public abstract class SSLEngineTest {
|
|||||||
// the unit test can terminate relativley quicly.
|
// the unit test can terminate relativley quicly.
|
||||||
sslHandler.setHandshakeTimeout(1, TimeUnit.SECONDS);
|
sslHandler.setHandshakeTimeout(1, TimeUnit.SECONDS);
|
||||||
p.addLast(sslHandler);
|
p.addLast(sslHandler);
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
private int handshakeCount;
|
private int handshakeCount;
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||||
@ -1650,7 +1650,7 @@ public abstract class SSLEngineTest {
|
|||||||
|
|
||||||
p.addLast(sslHandler);
|
p.addLast(sslHandler);
|
||||||
p.addLast(new MessageDelegatorChannelHandler(serverReceiver, serverLatch));
|
p.addLast(new MessageDelegatorChannelHandler(serverReceiver, serverLatch));
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
if (cause.getCause() instanceof SSLHandshakeException) {
|
if (cause.getCause() instanceof SSLHandshakeException) {
|
||||||
@ -1680,7 +1680,7 @@ public abstract class SSLEngineTest {
|
|||||||
|
|
||||||
p.addLast(sslHandler);
|
p.addLast(sslHandler);
|
||||||
p.addLast(new MessageDelegatorChannelHandler(clientReceiver, clientLatch));
|
p.addLast(new MessageDelegatorChannelHandler(clientReceiver, clientLatch));
|
||||||
p.addLast(new ChannelInboundHandlerAdapter() {
|
p.addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
if (cause.getCause() instanceof SSLHandshakeException) {
|
if (cause.getCause() instanceof SSLHandshakeException) {
|
||||||
@ -1734,7 +1734,7 @@ public abstract class SSLEngineTest {
|
|||||||
serverSslCtx.newHandler(ch.alloc(), delegatingExecutor);
|
serverSslCtx.newHandler(ch.alloc(), delegatingExecutor);
|
||||||
|
|
||||||
ch.pipeline().addFirst(sslHandler);
|
ch.pipeline().addFirst(sslHandler);
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt instanceof SslHandshakeCompletionEvent) {
|
if (evt instanceof SslHandshakeCompletionEvent) {
|
||||||
|
@ -20,7 +20,7 @@ import io.netty.bootstrap.ServerBootstrap;
|
|||||||
import io.netty.buffer.ByteBufAllocator;
|
import io.netty.buffer.ByteBufAllocator;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
@ -108,7 +108,7 @@ final class SniClientJava8TestUtil {
|
|||||||
handler.engine().setSSLParameters(parameters);
|
handler.engine().setSSLParameters(parameters);
|
||||||
|
|
||||||
ch.pipeline().addFirst(handler);
|
ch.pipeline().addFirst(handler);
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt instanceof SslHandshakeCompletionEvent) {
|
if (evt instanceof SslHandshakeCompletionEvent) {
|
||||||
|
@ -24,7 +24,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
@ -149,7 +149,7 @@ public class SniHandlerTest {
|
|||||||
final AtomicReference<SslHandshakeCompletionEvent> evtRef =
|
final AtomicReference<SslHandshakeCompletionEvent> evtRef =
|
||||||
new AtomicReference<>();
|
new AtomicReference<>();
|
||||||
SniHandler handler = new SniHandler(new DomainNameMappingBuilder<>(nettyContext).build());
|
SniHandler handler = new SniHandler(new DomainNameMappingBuilder<>(nettyContext).build());
|
||||||
EmbeddedChannel ch = new EmbeddedChannel(handler, new ChannelInboundHandlerAdapter() {
|
EmbeddedChannel ch = new EmbeddedChannel(handler, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt instanceof SslHandshakeCompletionEvent) {
|
if (evt instanceof SslHandshakeCompletionEvent) {
|
||||||
@ -196,7 +196,7 @@ public class SniHandlerTest {
|
|||||||
|
|
||||||
final AtomicReference<SniCompletionEvent> evtRef = new AtomicReference<>();
|
final AtomicReference<SniCompletionEvent> evtRef = new AtomicReference<>();
|
||||||
SniHandler handler = new SniHandler(mapping);
|
SniHandler handler = new SniHandler(mapping);
|
||||||
EmbeddedChannel ch = new EmbeddedChannel(handler, new ChannelInboundHandlerAdapter() {
|
EmbeddedChannel ch = new EmbeddedChannel(handler, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt instanceof SniCompletionEvent) {
|
if (evt instanceof SniCompletionEvent) {
|
||||||
|
@ -19,7 +19,7 @@ import io.netty.bootstrap.Bootstrap;
|
|||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
@ -174,7 +174,7 @@ public class SslErrorTest {
|
|||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(sslServerCtx.newHandler(ch.alloc()));
|
ch.pipeline().addLast(sslServerCtx.newHandler(ch.alloc()));
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
@ -192,7 +192,7 @@ public class SslErrorTest {
|
|||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(sslClientCtx.newHandler(ch.alloc()));
|
ch.pipeline().addLast(sslClientCtx.newHandler(ch.alloc()));
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
// Unwrap as its wrapped by a DecoderException
|
// Unwrap as its wrapped by a DecoderException
|
||||||
|
@ -27,9 +27,9 @@ import io.netty.channel.ChannelFuture;
|
|||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.channel.DefaultChannelId;
|
import io.netty.channel.DefaultChannelId;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
@ -95,7 +95,7 @@ public class SslHandlerTest {
|
|||||||
|
|
||||||
SSLEngine engine = SSLContext.getDefault().createSSLEngine();
|
SSLEngine engine = SSLContext.getDefault().createSSLEngine();
|
||||||
EmbeddedChannel ch = new EmbeddedChannel(
|
EmbeddedChannel ch = new EmbeddedChannel(
|
||||||
DefaultChannelId.newInstance(), false, false, new ChannelInboundHandlerAdapter() {
|
DefaultChannelId.newInstance(), false, false, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
// Not forward the event to the SslHandler but just close the Channel.
|
// Not forward the event to the SslHandler but just close the Channel.
|
||||||
@ -110,7 +110,7 @@ public class SslHandlerTest {
|
|||||||
super.handlerAdded(ctx);
|
super.handlerAdded(ctx);
|
||||||
inActive.set(false);
|
inActive.set(false);
|
||||||
}
|
}
|
||||||
}, new ChannelInboundHandlerAdapter() {
|
}, new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt instanceof SslHandshakeCompletionEvent) {
|
if (evt instanceof SslHandshakeCompletionEvent) {
|
||||||
@ -274,13 +274,13 @@ public class SslHandlerTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class TlsReadTest extends ChannelOutboundHandlerAdapter {
|
private static final class TlsReadTest implements ChannelOutboundHandler {
|
||||||
private volatile boolean readIssued;
|
private volatile boolean readIssued;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(ChannelHandlerContext ctx) throws Exception {
|
public void read(ChannelHandlerContext ctx) throws Exception {
|
||||||
readIssued = true;
|
readIssued = true;
|
||||||
super.read(ctx);
|
ctx.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test(final boolean dropChannelActive) throws Exception {
|
public void test(final boolean dropChannelActive) throws Exception {
|
||||||
@ -290,7 +290,7 @@ public class SslHandlerTest {
|
|||||||
EmbeddedChannel ch = new EmbeddedChannel(false, false,
|
EmbeddedChannel ch = new EmbeddedChannel(false, false,
|
||||||
this,
|
this,
|
||||||
new SslHandler(engine),
|
new SslHandler(engine),
|
||||||
new ChannelInboundHandlerAdapter() {
|
new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
if (!dropChannelActive) {
|
if (!dropChannelActive) {
|
||||||
@ -375,7 +375,7 @@ public class SslHandlerTest {
|
|||||||
ch.eventLoop().execute(ch::close);
|
ch.eventLoop().execute(ch::close);
|
||||||
});
|
});
|
||||||
|
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
if (cause instanceof CodecException) {
|
if (cause instanceof CodecException) {
|
||||||
@ -418,7 +418,7 @@ public class SslHandlerTest {
|
|||||||
public void testEventsFired() throws Exception {
|
public void testEventsFired() throws Exception {
|
||||||
SSLEngine engine = newServerModeSSLEngine();
|
SSLEngine engine = newServerModeSSLEngine();
|
||||||
final BlockingQueue<SslCompletionEvent> events = new LinkedBlockingQueue<>();
|
final BlockingQueue<SslCompletionEvent> events = new LinkedBlockingQueue<>();
|
||||||
EmbeddedChannel channel = new EmbeddedChannel(new SslHandler(engine), new ChannelInboundHandlerAdapter() {
|
EmbeddedChannel channel = new EmbeddedChannel(new SslHandler(engine), new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
if (evt instanceof SslCompletionEvent) {
|
if (evt instanceof SslCompletionEvent) {
|
||||||
@ -457,7 +457,7 @@ public class SslHandlerTest {
|
|||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) {
|
protected void initChannel(Channel ch) {
|
||||||
ch.pipeline().addLast(sslServerCtx.newHandler(ch.alloc()));
|
ch.pipeline().addLast(sslServerCtx.newHandler(ch.alloc()));
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) {
|
public void channelActive(ChannelHandlerContext ctx) {
|
||||||
ByteBuf buf = ctx.alloc().buffer(10);
|
ByteBuf buf = ctx.alloc().buffer(10);
|
||||||
@ -486,7 +486,7 @@ public class SslHandlerTest {
|
|||||||
.handler(new ChannelInitializer<Channel>() {
|
.handler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) {
|
protected void initChannel(Channel ch) {
|
||||||
ch.pipeline().addFirst(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addFirst(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) {
|
public void channelActive(ChannelHandlerContext ctx) {
|
||||||
ByteBuf buf = ctx.alloc().buffer(1000);
|
ByteBuf buf = ctx.alloc().buffer(1000);
|
||||||
@ -691,7 +691,7 @@ public class SslHandlerTest {
|
|||||||
sc = new ServerBootstrap()
|
sc = new ServerBootstrap()
|
||||||
.group(group)
|
.group(group)
|
||||||
.channel(NioServerSocketChannel.class)
|
.channel(NioServerSocketChannel.class)
|
||||||
.childHandler(new ChannelInboundHandlerAdapter())
|
.childHandler(new ChannelInboundHandler() { })
|
||||||
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
||||||
|
|
||||||
cc = new Bootstrap()
|
cc = new Bootstrap()
|
||||||
@ -701,7 +701,7 @@ public class SslHandlerTest {
|
|||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(sslHandler);
|
ch.pipeline().addLast(sslHandler);
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
@ -770,7 +770,7 @@ public class SslHandlerTest {
|
|||||||
sc = new ServerBootstrap()
|
sc = new ServerBootstrap()
|
||||||
.group(group)
|
.group(group)
|
||||||
.channel(NioServerSocketChannel.class)
|
.channel(NioServerSocketChannel.class)
|
||||||
.childHandler(new ChannelInboundHandlerAdapter())
|
.childHandler(new ChannelInboundHandler() { })
|
||||||
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
||||||
|
|
||||||
ChannelFuture future = new Bootstrap()
|
ChannelFuture future = new Bootstrap()
|
||||||
@ -781,7 +781,7 @@ public class SslHandlerTest {
|
|||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(sslHandler);
|
ch.pipeline().addLast(sslHandler);
|
||||||
if (startTls) {
|
if (startTls) {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
ctx.writeAndFlush(wrappedBuffer(new byte[] { 1, 2, 3, 4 }));
|
ctx.writeAndFlush(wrappedBuffer(new byte[] { 1, 2, 3, 4 }));
|
||||||
|
@ -23,7 +23,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
@ -164,7 +164,7 @@ public class OcspTest {
|
|||||||
*/
|
*/
|
||||||
private static void testClientAcceptingOcspStaple(SslProvider sslProvider) throws Exception {
|
private static void testClientAcceptingOcspStaple(SslProvider sslProvider) throws Exception {
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
ChannelInboundHandlerAdapter serverHandler = new ChannelInboundHandlerAdapter() {
|
ChannelInboundHandler serverHandler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
ctx.writeAndFlush(Unpooled.wrappedBuffer("Hello, World!".getBytes()));
|
ctx.writeAndFlush(Unpooled.wrappedBuffer("Hello, World!".getBytes()));
|
||||||
@ -172,7 +172,7 @@ public class OcspTest {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ChannelInboundHandlerAdapter clientHandler = new ChannelInboundHandlerAdapter() {
|
ChannelInboundHandler clientHandler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
try {
|
try {
|
||||||
@ -212,7 +212,7 @@ public class OcspTest {
|
|||||||
final AtomicReference<Throwable> causeRef = new AtomicReference<>();
|
final AtomicReference<Throwable> causeRef = new AtomicReference<>();
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
|
||||||
ChannelInboundHandlerAdapter clientHandler = new ChannelInboundHandlerAdapter() {
|
ChannelInboundHandler clientHandler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
try {
|
try {
|
||||||
@ -253,7 +253,7 @@ public class OcspTest {
|
|||||||
*/
|
*/
|
||||||
private static void testServerHasNoStaple(SslProvider sslProvider) throws Exception {
|
private static void testServerHasNoStaple(SslProvider sslProvider) throws Exception {
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
ChannelInboundHandlerAdapter serverHandler = new ChannelInboundHandlerAdapter() {
|
ChannelInboundHandler serverHandler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
ctx.writeAndFlush(Unpooled.wrappedBuffer("Hello, World!".getBytes()));
|
ctx.writeAndFlush(Unpooled.wrappedBuffer("Hello, World!".getBytes()));
|
||||||
@ -261,7 +261,7 @@ public class OcspTest {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ChannelInboundHandlerAdapter clientHandler = new ChannelInboundHandlerAdapter() {
|
ChannelInboundHandler clientHandler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
try {
|
try {
|
||||||
@ -302,7 +302,7 @@ public class OcspTest {
|
|||||||
final AtomicReference<Throwable> causeRef = new AtomicReference<>();
|
final AtomicReference<Throwable> causeRef = new AtomicReference<>();
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
|
||||||
ChannelInboundHandlerAdapter clientHandler = new ChannelInboundHandlerAdapter() {
|
ChannelInboundHandler clientHandler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
try {
|
try {
|
||||||
|
@ -21,7 +21,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandler;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.util.CharsetUtil;
|
import io.netty.util.CharsetUtil;
|
||||||
@ -273,7 +273,7 @@ public class ChunkedWriteHandlerTest {
|
|||||||
// See https://github.com/netty/netty/issues/8700.
|
// See https://github.com/netty/netty/issues/8700.
|
||||||
@Test
|
@Test
|
||||||
public void testFailureWhenLastChunkFailed() throws IOException {
|
public void testFailureWhenLastChunkFailed() throws IOException {
|
||||||
ChannelOutboundHandlerAdapter failLast = new ChannelOutboundHandlerAdapter() {
|
ChannelOutboundHandler failLast = new ChannelOutboundHandler() {
|
||||||
private int passedWrites;
|
private int passedWrites;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -409,7 +409,7 @@ public class ChunkedWriteHandlerTest {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ChannelOutboundHandlerAdapter noOpWrites = new ChannelOutboundHandlerAdapter() {
|
ChannelOutboundHandler noOpWrites = new ChannelOutboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
|
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
|
||||||
ReferenceCountUtil.release(msg);
|
ReferenceCountUtil.release(msg);
|
||||||
@ -595,7 +595,7 @@ public class ChunkedWriteHandlerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void checkFirstFailed(Object input) {
|
private static void checkFirstFailed(Object input) {
|
||||||
ChannelOutboundHandlerAdapter noOpWrites = new ChannelOutboundHandlerAdapter() {
|
ChannelOutboundHandler noOpWrites = new ChannelOutboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
|
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
|
||||||
ReferenceCountUtil.release(msg);
|
ReferenceCountUtil.release(msg);
|
||||||
@ -612,7 +612,7 @@ public class ChunkedWriteHandlerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void checkSkipFailed(Object input1, Object input2) {
|
private static void checkSkipFailed(Object input1, Object input2) {
|
||||||
ChannelOutboundHandlerAdapter failFirst = new ChannelOutboundHandlerAdapter() {
|
ChannelOutboundHandler failFirst = new ChannelOutboundHandler() {
|
||||||
private boolean alreadyFailed;
|
private boolean alreadyFailed;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,7 +25,7 @@ import static org.junit.Assert.assertTrue;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOutboundBuffer;
|
import io.netty.channel.ChannelOutboundBuffer;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
@ -72,7 +72,7 @@ public class IdleStateHandlerTest {
|
|||||||
assertTrue("The number of expected events must be >= 1", expected.length >= 1);
|
assertTrue("The number of expected events must be >= 1", expected.length >= 1);
|
||||||
|
|
||||||
final List<Object> events = new ArrayList<>();
|
final List<Object> events = new ArrayList<>();
|
||||||
ChannelInboundHandlerAdapter handler = new ChannelInboundHandlerAdapter() {
|
ChannelInboundHandler handler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
events.add(evt);
|
events.add(evt);
|
||||||
@ -143,7 +143,7 @@ public class IdleStateHandlerTest {
|
|||||||
Action action, Object expected) throws Exception {
|
Action action, Object expected) throws Exception {
|
||||||
|
|
||||||
final List<Object> events = new ArrayList<>();
|
final List<Object> events = new ArrayList<>();
|
||||||
ChannelInboundHandlerAdapter handler = new ChannelInboundHandlerAdapter() {
|
ChannelInboundHandler handler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
events.add(evt);
|
events.add(evt);
|
||||||
@ -203,7 +203,7 @@ public class IdleStateHandlerTest {
|
|||||||
true, 0L, writerIdleTime, allIdleTime, TimeUnit.SECONDS);
|
true, 0L, writerIdleTime, allIdleTime, TimeUnit.SECONDS);
|
||||||
|
|
||||||
final List<Object> events = new ArrayList<>();
|
final List<Object> events = new ArrayList<>();
|
||||||
ChannelInboundHandlerAdapter handler = new ChannelInboundHandlerAdapter() {
|
ChannelInboundHandler handler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
events.add(evt);
|
events.add(evt);
|
||||||
|
@ -20,7 +20,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.buffer.UnpooledByteBufAllocator;
|
import io.netty.buffer.UnpooledByteBufAllocator;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import io.netty.microbench.channel.EmbeddedChannelWriteReleaseHandlerContext;
|
import io.netty.microbench.channel.EmbeddedChannelWriteReleaseHandlerContext;
|
||||||
import io.netty.microbench.util.AbstractMicrobenchmark;
|
import io.netty.microbench.util.AbstractMicrobenchmark;
|
||||||
@ -79,7 +79,7 @@ public class Http2FrameWriterDataBenchmark extends AbstractMicrobenchmark {
|
|||||||
payload.writeZero(payloadSize);
|
payload.writeZero(payloadSize);
|
||||||
ctx = new EmbeddedChannelWriteReleaseHandlerContext(
|
ctx = new EmbeddedChannelWriteReleaseHandlerContext(
|
||||||
pooled ? PooledByteBufAllocator.DEFAULT : UnpooledByteBufAllocator.DEFAULT,
|
pooled ? PooledByteBufAllocator.DEFAULT : UnpooledByteBufAllocator.DEFAULT,
|
||||||
new ChannelInboundHandlerAdapter()) {
|
new ChannelInboundHandler() { }) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleException(Throwable t) {
|
protected void handleException(Throwable t) {
|
||||||
handleUnexpectedException(t);
|
handleUnexpectedException(t);
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package io.netty.microbench.channel;
|
package io.netty.microbench.channel;
|
||||||
|
|
||||||
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandler;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.embedded.EmbeddedChannel;
|
import io.netty.channel.embedded.EmbeddedChannel;
|
||||||
import io.netty.microbench.util.AbstractMicrobenchmark;
|
import io.netty.microbench.util.AbstractMicrobenchmark;
|
||||||
@ -37,23 +37,15 @@ import org.openjdk.jmh.infra.Blackhole;
|
|||||||
@State(Scope.Benchmark)
|
@State(Scope.Benchmark)
|
||||||
public class DefaultChannelPipelineBenchmark extends AbstractMicrobenchmark {
|
public class DefaultChannelPipelineBenchmark extends AbstractMicrobenchmark {
|
||||||
|
|
||||||
private static final ChannelInboundHandler NOOP_HANDLER = new ChannelInboundHandlerAdapter() {
|
@ChannelHandler.Sharable
|
||||||
@Override
|
private static final ChannelInboundHandler NOOP_HANDLER = new ChannelInboundHandler() { };
|
||||||
public boolean isSharable() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private static final ChannelInboundHandler CONSUMING_HANDLER = new ChannelInboundHandlerAdapter() {
|
@ChannelHandler.Sharable
|
||||||
|
private static final ChannelInboundHandler CONSUMING_HANDLER = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelReadComplete(ChannelHandlerContext ctx) {
|
public void channelReadComplete(ChannelHandlerContext ctx) {
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSharable() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@Param({ "4" })
|
@Param({ "4" })
|
||||||
|
@ -24,7 +24,7 @@ import io.netty.channel.ChannelFactory;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
@ -1111,7 +1111,7 @@ public class DnsNameResolver extends InetNameResolver {
|
|||||||
return dnsServerAddressStreamProvider.nameServerAddressStream(hostname);
|
return dnsServerAddressStreamProvider.nameServerAddressStream(hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class DnsResponseHandler extends ChannelInboundHandlerAdapter {
|
private final class DnsResponseHandler implements ChannelInboundHandler {
|
||||||
|
|
||||||
private final Promise<Channel> channelActivePromise;
|
private final Promise<Channel> channelActivePromise;
|
||||||
|
|
||||||
@ -1143,7 +1143,7 @@ public class DnsNameResolver extends InetNameResolver {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
super.channelActive(ctx);
|
ctx.fireChannelActive();
|
||||||
channelActivePromise.setSuccess(ctx.channel());
|
channelActivePromise.setSuccess(ctx.channel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.handler.codec.http.DefaultFullHttpResponse;
|
import io.netty.handler.codec.http.DefaultFullHttpResponse;
|
||||||
import io.netty.handler.codec.http.FullHttpResponse;
|
import io.netty.handler.codec.http.FullHttpResponse;
|
||||||
import io.netty.handler.codec.http.HttpHeaderNames;
|
import io.netty.handler.codec.http.HttpHeaderNames;
|
||||||
@ -48,7 +48,7 @@ import static io.netty.handler.codec.http.HttpVersion.*;
|
|||||||
/**
|
/**
|
||||||
* Handles handshakes and messages
|
* Handles handshakes and messages
|
||||||
*/
|
*/
|
||||||
public class AutobahnServerHandler extends ChannelInboundHandlerAdapter {
|
public class AutobahnServerHandler implements ChannelInboundHandler {
|
||||||
private static final Logger logger = Logger.getLogger(AutobahnServerHandler.class.getName());
|
private static final Logger logger = Logger.getLogger(AutobahnServerHandler.class.getName());
|
||||||
|
|
||||||
private WebSocketServerHandshaker handshaker;
|
private WebSocketServerHandshaker handshaker;
|
||||||
|
@ -19,7 +19,7 @@ package io.netty.testsuite.http2;
|
|||||||
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
|
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
@ -28,7 +28,6 @@ import io.netty.handler.codec.http.HttpMessage;
|
|||||||
import io.netty.handler.codec.http.HttpObjectAggregator;
|
import io.netty.handler.codec.http.HttpObjectAggregator;
|
||||||
import io.netty.handler.codec.http.HttpServerCodec;
|
import io.netty.handler.codec.http.HttpServerCodec;
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler;
|
import io.netty.handler.codec.http.HttpServerUpgradeHandler;
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodec;
|
|
||||||
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodecFactory;
|
import io.netty.handler.codec.http.HttpServerUpgradeHandler.UpgradeCodecFactory;
|
||||||
import io.netty.handler.codec.http2.CleartextHttp2ServerUpgradeHandler;
|
import io.netty.handler.codec.http2.CleartextHttp2ServerUpgradeHandler;
|
||||||
import io.netty.handler.codec.http2.Http2CodecUtil;
|
import io.netty.handler.codec.http2.Http2CodecUtil;
|
||||||
@ -97,7 +96,7 @@ public class Http2ServerInitializer extends ChannelInitializer<SocketChannel> {
|
|||||||
/**
|
/**
|
||||||
* Class that logs any User Events triggered on this channel.
|
* Class that logs any User Events triggered on this channel.
|
||||||
*/
|
*/
|
||||||
private static class UserEventLogger extends ChannelInboundHandlerAdapter {
|
private static class UserEventLogger implements ChannelInboundHandler {
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||||
System.out.println("User Event Triggered: " + evt);
|
System.out.println("User Event Triggered: " + evt);
|
||||||
|
@ -24,7 +24,7 @@ import io.netty.channel.Channel;
|
|||||||
import io.netty.channel.ChannelConfig;
|
import io.netty.channel.ChannelConfig;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
@ -54,7 +54,7 @@ public class CompositeBufferGatheringWriteTest extends AbstractSocketTest {
|
|||||||
sb.childHandler(new ChannelInitializer<Channel>() {
|
sb.childHandler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
ctx.writeAndFlush(newCompositeBuffer(ctx.alloc()))
|
ctx.writeAndFlush(newCompositeBuffer(ctx.alloc()))
|
||||||
@ -66,7 +66,7 @@ public class CompositeBufferGatheringWriteTest extends AbstractSocketTest {
|
|||||||
cb.handler(new ChannelInitializer<Channel>() {
|
cb.handler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
private ByteBuf aggregator;
|
private ByteBuf aggregator;
|
||||||
@Override
|
@Override
|
||||||
public void handlerAdded(ChannelHandlerContext ctx) {
|
public void handlerAdded(ChannelHandlerContext ctx) {
|
||||||
@ -164,7 +164,7 @@ public class CompositeBufferGatheringWriteTest extends AbstractSocketTest {
|
|||||||
.childHandler(new ChannelInitializer<Channel>() {
|
.childHandler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
compositeBufferPartialWriteDoesNotCorruptDataInitServerConfig(ctx.channel().config(),
|
compositeBufferPartialWriteDoesNotCorruptDataInitServerConfig(ctx.channel().config(),
|
||||||
@ -208,7 +208,7 @@ public class CompositeBufferGatheringWriteTest extends AbstractSocketTest {
|
|||||||
cb.handler(new ChannelInitializer<Channel>() {
|
cb.handler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
private ByteBuf aggregator;
|
private ByteBuf aggregator;
|
||||||
@Override
|
@Override
|
||||||
public void handlerAdded(ChannelHandlerContext ctx) {
|
public void handlerAdded(ChannelHandlerContext ctx) {
|
||||||
|
@ -20,7 +20,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||||
import io.netty.util.CharsetUtil;
|
import io.netty.util.CharsetUtil;
|
||||||
import io.netty.util.NetUtil;
|
import io.netty.util.NetUtil;
|
||||||
@ -46,7 +46,7 @@ public class DatagramConnectNotExistsTest extends AbstractClientSocketTest {
|
|||||||
|
|
||||||
public void testConnectNotExists(Bootstrap cb) throws Throwable {
|
public void testConnectNotExists(Bootstrap cb) throws Throwable {
|
||||||
final Promise<Throwable> promise = ImmediateEventExecutor.INSTANCE.newPromise();
|
final Promise<Throwable> promise = ImmediateEventExecutor.INSTANCE.newPromise();
|
||||||
cb.handler(new ChannelInboundHandlerAdapter() {
|
cb.handler(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
promise.trySuccess(cause);
|
promise.trySuccess(cause);
|
||||||
|
@ -19,7 +19,7 @@ import io.netty.bootstrap.ServerBootstrap;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.util.internal.SocketUtils;
|
import io.netty.util.internal.SocketUtils;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
@ -94,7 +94,7 @@ public class ServerSocketSuspendTest extends AbstractServerSocketTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
private static final class AcceptedChannelCounter extends ChannelInboundHandlerAdapter {
|
private static final class AcceptedChannelCounter implements ChannelInboundHandler {
|
||||||
|
|
||||||
final CountDownLatch latch;
|
final CountDownLatch latch;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelConfig;
|
import io.netty.channel.ChannelConfig;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.RecvByteBufAllocator;
|
import io.netty.channel.RecvByteBufAllocator;
|
||||||
@ -116,7 +116,7 @@ public class SocketAutoReadTest extends AbstractSocketTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class AutoReadHandler extends ChannelInboundHandlerAdapter {
|
private static final class AutoReadHandler implements ChannelInboundHandler {
|
||||||
private final AtomicInteger count = new AtomicInteger();
|
private final AtomicInteger count = new AtomicInteger();
|
||||||
private final CountDownLatch latch = new CountDownLatch(1);
|
private final CountDownLatch latch = new CountDownLatch(1);
|
||||||
private final CountDownLatch latch2;
|
private final CountDownLatch latch2;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
package io.netty.testsuite.transport.socket;
|
package io.netty.testsuite.transport.socket;
|
||||||
|
|
||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.socket.SocketChannel;
|
import io.netty.channel.socket.SocketChannel;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ public class SocketChannelNotYetConnectedTest extends AbstractClientSocketTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testShutdownNotYetConnected(Bootstrap cb) throws Throwable {
|
public void testShutdownNotYetConnected(Bootstrap cb) throws Throwable {
|
||||||
SocketChannel ch = (SocketChannel) cb.handler(new ChannelInboundHandlerAdapter())
|
SocketChannel ch = (SocketChannel) cb.handler(new ChannelInboundHandler() { })
|
||||||
.bind(newSocketAddress()).syncUninterruptibly().channel();
|
.bind(newSocketAddress()).syncUninterruptibly().channel();
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
|
@ -19,7 +19,7 @@ import io.netty.bootstrap.Bootstrap;
|
|||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.socket.SocketChannel;
|
import io.netty.channel.socket.SocketChannel;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public class SocketCloseForciblyTest extends AbstractSocketTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testCloseForcibly(ServerBootstrap sb, Bootstrap cb) throws Throwable {
|
public void testCloseForcibly(ServerBootstrap sb, Bootstrap cb) throws Throwable {
|
||||||
sb.handler(new ChannelInboundHandlerAdapter() {
|
sb.handler(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
final SocketChannel childChannel = (SocketChannel) msg;
|
final SocketChannel childChannel = (SocketChannel) msg;
|
||||||
@ -41,9 +41,9 @@ public class SocketCloseForciblyTest extends AbstractSocketTest {
|
|||||||
childChannel.unsafe().closeForcibly();
|
childChannel.unsafe().closeForcibly();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).childHandler(new ChannelInboundHandlerAdapter());
|
}).childHandler(new ChannelInboundHandler() { });
|
||||||
|
|
||||||
cb.handler(new ChannelInboundHandlerAdapter());
|
cb.handler(new ChannelInboundHandler() { });
|
||||||
|
|
||||||
Channel sc = sb.bind().sync().channel();
|
Channel sc = sb.bind().sync().channel();
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelDuplexHandler;
|
import io.netty.channel.ChannelDuplexHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.WriteBufferWaterMark;
|
import io.netty.channel.WriteBufferWaterMark;
|
||||||
@ -90,7 +90,7 @@ public class SocketConditionalWritabilityTest extends AbstractSocketTest {
|
|||||||
cb.handler(new ChannelInitializer<Channel>() {
|
cb.handler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) {
|
protected void initChannel(Channel ch) {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
private int totalRead;
|
private int totalRead;
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) {
|
public void channelActive(ChannelHandlerContext ctx) {
|
||||||
|
@ -20,7 +20,7 @@ import io.netty.bootstrap.ServerBootstrap;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.util.concurrent.ImmediateEventExecutor;
|
import io.netty.util.concurrent.ImmediateEventExecutor;
|
||||||
import io.netty.util.concurrent.Promise;
|
import io.netty.util.concurrent.Promise;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -43,14 +43,14 @@ public class SocketConnectTest extends AbstractSocketTest {
|
|||||||
Channel clientChannel = null;
|
Channel clientChannel = null;
|
||||||
try {
|
try {
|
||||||
final Promise<InetSocketAddress> localAddressPromise = ImmediateEventExecutor.INSTANCE.newPromise();
|
final Promise<InetSocketAddress> localAddressPromise = ImmediateEventExecutor.INSTANCE.newPromise();
|
||||||
serverChannel = sb.childHandler(new ChannelInboundHandlerAdapter() {
|
serverChannel = sb.childHandler(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
localAddressPromise.setSuccess((InetSocketAddress) ctx.channel().localAddress());
|
localAddressPromise.setSuccess((InetSocketAddress) ctx.channel().localAddress());
|
||||||
}
|
}
|
||||||
}).bind().syncUninterruptibly().channel();
|
}).bind().syncUninterruptibly().channel();
|
||||||
|
|
||||||
clientChannel = cb.handler(new ChannelInboundHandlerAdapter()).register().syncUninterruptibly().channel();
|
clientChannel = cb.handler(new ChannelInboundHandler() { }).register().syncUninterruptibly().channel();
|
||||||
|
|
||||||
assertNull(clientChannel.localAddress());
|
assertNull(clientChannel.localAddress());
|
||||||
assertNull(clientChannel.remoteAddress());
|
assertNull(clientChannel.remoteAddress());
|
||||||
@ -81,10 +81,10 @@ public class SocketConnectTest extends AbstractSocketTest {
|
|||||||
Channel sc = null;
|
Channel sc = null;
|
||||||
Channel cc = null;
|
Channel cc = null;
|
||||||
try {
|
try {
|
||||||
sb.childHandler(new ChannelInboundHandlerAdapter());
|
sb.childHandler(new ChannelInboundHandler() { });
|
||||||
sc = sb.bind().syncUninterruptibly().channel();
|
sc = sb.bind().syncUninterruptibly().channel();
|
||||||
|
|
||||||
cb.handler(new ChannelInboundHandlerAdapter() {
|
cb.handler(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
events.add(0);
|
events.add(0);
|
||||||
|
@ -19,7 +19,7 @@ import io.netty.bootstrap.Bootstrap;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.util.internal.SocketUtils;
|
import io.netty.util.internal.SocketUtils;
|
||||||
import io.netty.util.NetUtil;
|
import io.netty.util.NetUtil;
|
||||||
@ -78,7 +78,7 @@ public class SocketConnectionAttemptTest extends AbstractClientSocketTest {
|
|||||||
|
|
||||||
private static void testConnectRefused0(Bootstrap cb, boolean halfClosure) throws Throwable {
|
private static void testConnectRefused0(Bootstrap cb, boolean halfClosure) throws Throwable {
|
||||||
final Promise<Error> errorPromise = GlobalEventExecutor.INSTANCE.newPromise();
|
final Promise<Error> errorPromise = GlobalEventExecutor.INSTANCE.newPromise();
|
||||||
ChannelHandler handler = new ChannelInboundHandlerAdapter() {
|
ChannelHandler handler = new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
errorPromise.setFailure(new AssertionError("should have never been called"));
|
errorPromise.setFailure(new AssertionError("should have never been called"));
|
||||||
@ -142,7 +142,7 @@ public class SocketConnectionAttemptTest extends AbstractClientSocketTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TestHandler extends ChannelInboundHandlerAdapter {
|
private static class TestHandler implements ChannelInboundHandler {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
InternalLoggerFactory.getInstance(
|
InternalLoggerFactory.getInstance(
|
||||||
|
@ -20,7 +20,7 @@ import io.netty.bootstrap.ServerBootstrap;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -55,7 +55,7 @@ public class SocketDataReadInitialStateTest extends AbstractSocketTest {
|
|||||||
sb.handler(new ChannelInitializer<Channel>() {
|
sb.handler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) {
|
protected void initChannel(Channel ch) {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
acceptorReadLatch.countDown();
|
acceptorReadLatch.countDown();
|
||||||
|
@ -21,7 +21,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -85,7 +85,7 @@ public class SocketEchoTest extends AbstractSocketTest {
|
|||||||
final EchoHandler ch = new EchoHandler(autoRead);
|
final EchoHandler ch = new EchoHandler(autoRead);
|
||||||
|
|
||||||
sb.childHandler(sh);
|
sb.childHandler(sh);
|
||||||
sb.handler(new ChannelInboundHandlerAdapter() {
|
sb.handler(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
cause.printStackTrace();
|
cause.printStackTrace();
|
||||||
|
@ -20,7 +20,7 @@ import io.netty.bootstrap.ServerBootstrap;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
@ -83,7 +83,7 @@ public class SocketExceptionHandlingTest extends AbstractSocketTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class BuggyChannelHandler extends ChannelInboundHandlerAdapter {
|
private static class BuggyChannelHandler implements ChannelInboundHandler {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
ReferenceCountUtil.release(msg);
|
ReferenceCountUtil.release(msg);
|
||||||
@ -91,7 +91,7 @@ public class SocketExceptionHandlingTest extends AbstractSocketTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ExceptionHandler extends ChannelInboundHandlerAdapter {
|
private static class ExceptionHandler implements ChannelInboundHandler {
|
||||||
final AtomicLong count = new AtomicLong();
|
final AtomicLong count = new AtomicLong();
|
||||||
/**
|
/**
|
||||||
* We expect to get 1 call to {@link #exceptionCaught(ChannelHandlerContext, Throwable)}.
|
* We expect to get 1 call to {@link #exceptionCaught(ChannelHandlerContext, Throwable)}.
|
||||||
|
@ -22,7 +22,6 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandler;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.DefaultFileRegion;
|
import io.netty.channel.DefaultFileRegion;
|
||||||
import io.netty.channel.FileRegion;
|
import io.netty.channel.FileRegion;
|
||||||
@ -114,7 +113,7 @@ public class SocketFileRegionTest extends AbstractSocketTest {
|
|||||||
// Just drop the message.
|
// Just drop the message.
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cb.handler(new ChannelInboundHandlerAdapter());
|
cb.handler(new ChannelInboundHandler() { });
|
||||||
|
|
||||||
Channel sc = sb.bind().sync().channel();
|
Channel sc = sb.bind().sync().channel();
|
||||||
Channel cc = cb.connect(sc.localAddress()).sync().channel();
|
Channel cc = cb.connect(sc.localAddress()).sync().channel();
|
||||||
|
@ -21,10 +21,9 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.buffer.ByteBufAllocator;
|
import io.netty.buffer.ByteBufAllocator;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelConfig;
|
import io.netty.channel.ChannelConfig;
|
||||||
import io.netty.channel.ChannelFuture;
|
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.RecvByteBufAllocator;
|
import io.netty.channel.RecvByteBufAllocator;
|
||||||
@ -62,7 +61,7 @@ public class SocketHalfClosedTest extends AbstractSocketTest {
|
|||||||
sb.childHandler(new ChannelInitializer<Channel>() {
|
sb.childHandler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) {
|
protected void initChannel(Channel ch) {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) {
|
public void channelActive(ChannelHandlerContext ctx) {
|
||||||
((DuplexChannel) ctx).shutdownOutput();
|
((DuplexChannel) ctx).shutdownOutput();
|
||||||
@ -82,7 +81,7 @@ public class SocketHalfClosedTest extends AbstractSocketTest {
|
|||||||
cb.handler(new ChannelInitializer<Channel>() {
|
cb.handler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) {
|
protected void initChannel(Channel ch) {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(final ChannelHandlerContext ctx, Object evt) {
|
public void userEventTriggered(final ChannelHandlerContext ctx, Object evt) {
|
||||||
@ -142,7 +141,7 @@ public class SocketHalfClosedTest extends AbstractSocketTest {
|
|||||||
sb.childHandler(new ChannelInitializer<Channel>() {
|
sb.childHandler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
ByteBuf buf = ctx.alloc().buffer(totalServerBytesWritten);
|
ByteBuf buf = ctx.alloc().buffer(totalServerBytesWritten);
|
||||||
@ -163,7 +162,7 @@ public class SocketHalfClosedTest extends AbstractSocketTest {
|
|||||||
cb.handler(new ChannelInitializer<Channel>() {
|
cb.handler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
private int bytesRead;
|
private int bytesRead;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -441,7 +440,7 @@ public class SocketHalfClosedTest extends AbstractSocketTest {
|
|||||||
sb.childHandler(new ChannelInitializer<Channel>() {
|
sb.childHandler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
ByteBuf buf = ctx.alloc().buffer(totalServerBytesWritten);
|
ByteBuf buf = ctx.alloc().buffer(totalServerBytesWritten);
|
||||||
@ -461,7 +460,7 @@ public class SocketHalfClosedTest extends AbstractSocketTest {
|
|||||||
cb.handler(new ChannelInitializer<Channel>() {
|
cb.handler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
private int bytesRead;
|
private int bytesRead;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,7 +19,7 @@ import io.netty.bootstrap.Bootstrap;
|
|||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||||
import io.netty.util.NetUtil;
|
import io.netty.util.NetUtil;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -41,10 +41,10 @@ public class SocketMultipleConnectTest extends AbstractSocketTest {
|
|||||||
Channel sc = null;
|
Channel sc = null;
|
||||||
Channel cc = null;
|
Channel cc = null;
|
||||||
try {
|
try {
|
||||||
sb.childHandler(new ChannelInboundHandlerAdapter());
|
sb.childHandler(new ChannelInboundHandler() { });
|
||||||
sc = sb.bind(NetUtil.LOCALHOST, 0).syncUninterruptibly().channel();
|
sc = sb.bind(NetUtil.LOCALHOST, 0).syncUninterruptibly().channel();
|
||||||
|
|
||||||
cb.handler(new ChannelInboundHandlerAdapter());
|
cb.handler(new ChannelInboundHandler() { });
|
||||||
cc = cb.register().syncUninterruptibly().channel();
|
cc = cb.register().syncUninterruptibly().channel();
|
||||||
cc.connect(sc.localAddress()).syncUninterruptibly();
|
cc.connect(sc.localAddress()).syncUninterruptibly();
|
||||||
ChannelFuture connectFuture2 = cc.connect(sc.localAddress()).await();
|
ChannelFuture connectFuture2 = cc.connect(sc.localAddress()).await();
|
||||||
|
@ -19,7 +19,7 @@ import io.netty.bootstrap.Bootstrap;
|
|||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.handler.codec.serialization.ClassResolvers;
|
import io.netty.handler.codec.serialization.ClassResolvers;
|
||||||
@ -149,7 +149,7 @@ public class SocketObjectEchoTest extends AbstractSocketTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EchoHandler extends ChannelInboundHandlerAdapter {
|
private static class EchoHandler implements ChannelInboundHandler {
|
||||||
private final boolean autoRead;
|
private final boolean autoRead;
|
||||||
volatile Channel channel;
|
volatile Channel channel;
|
||||||
final AtomicReference<Throwable> exception = new AtomicReference<>();
|
final AtomicReference<Throwable> exception = new AtomicReference<>();
|
||||||
|
@ -23,7 +23,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelConfig;
|
import io.netty.channel.ChannelConfig;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.RecvByteBufAllocator;
|
import io.netty.channel.RecvByteBufAllocator;
|
||||||
@ -101,7 +101,7 @@ public class SocketReadPendingTest extends AbstractSocketTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class ReadPendingReadHandler extends ChannelInboundHandlerAdapter {
|
private static final class ReadPendingReadHandler implements ChannelInboundHandler {
|
||||||
private final AtomicInteger count = new AtomicInteger();
|
private final AtomicInteger count = new AtomicInteger();
|
||||||
private final CountDownLatch latch = new CountDownLatch(1);
|
private final CountDownLatch latch = new CountDownLatch(1);
|
||||||
private final CountDownLatch latch2 = new CountDownLatch(2);
|
private final CountDownLatch latch2 = new CountDownLatch(2);
|
||||||
|
@ -19,7 +19,7 @@ import io.netty.bootstrap.Bootstrap;
|
|||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -62,7 +62,7 @@ public class SocketRstTest extends AbstractSocketTest {
|
|||||||
cb.handler(new ChannelInitializer<Channel>() {
|
cb.handler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
throwableRef.compareAndSet(null, cause);
|
throwableRef.compareAndSet(null, cause);
|
||||||
@ -115,7 +115,7 @@ public class SocketRstTest extends AbstractSocketTest {
|
|||||||
cb.handler(new ChannelInitializer<Channel>() {
|
cb.handler(new ChannelInitializer<Channel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
|
ch.pipeline().addLast(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
throwableRef.compareAndSet(null, cause);
|
throwableRef.compareAndSet(null, cause);
|
||||||
|
@ -20,7 +20,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
import io.netty.channel.WriteBufferWaterMark;
|
import io.netty.channel.WriteBufferWaterMark;
|
||||||
@ -216,7 +216,7 @@ public class SocketShutdownOutputBySelfTest extends AbstractClientSocketTest {
|
|||||||
ChannelFuture cf = null;
|
ChannelFuture cf = null;
|
||||||
try {
|
try {
|
||||||
ss.bind(newSocketAddress());
|
ss.bind(newSocketAddress());
|
||||||
cf = cb.option(ChannelOption.SO_LINGER, 1).handler(new ChannelInboundHandlerAdapter())
|
cf = cb.option(ChannelOption.SO_LINGER, 1).handler(new ChannelInboundHandler() { })
|
||||||
.connect(ss.getLocalSocketAddress()).sync();
|
.connect(ss.getLocalSocketAddress()).sync();
|
||||||
s = ss.accept();
|
s = ss.accept();
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.netty.testsuite.transport.socket;
|
|||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.socket.SocketChannel;
|
import io.netty.channel.socket.SocketChannel;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public class WriteBeforeRegisteredTest extends AbstractClientSocketTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TestHandler extends ChannelInboundHandlerAdapter {
|
private static class TestHandler implements ChannelInboundHandler {
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
cause.printStackTrace();
|
cause.printStackTrace();
|
||||||
|
@ -18,10 +18,9 @@ package io.netty.channel.epoll;
|
|||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.unix.DomainSocketReadMode;
|
import io.netty.channel.unix.DomainSocketReadMode;
|
||||||
import io.netty.channel.unix.FileDescriptor;
|
import io.netty.channel.unix.FileDescriptor;
|
||||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||||
@ -53,7 +52,7 @@ public class EpollDomainSocketFdTest extends AbstractSocketTest {
|
|||||||
|
|
||||||
public void testSendRecvFd(ServerBootstrap sb, Bootstrap cb) throws Throwable {
|
public void testSendRecvFd(ServerBootstrap sb, Bootstrap cb) throws Throwable {
|
||||||
final BlockingQueue<Object> queue = new LinkedBlockingQueue<>(1);
|
final BlockingQueue<Object> queue = new LinkedBlockingQueue<>(1);
|
||||||
sb.childHandler(new ChannelInboundHandlerAdapter() {
|
sb.childHandler(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
// Create new channel and obtain a file descriptor from it.
|
// Create new channel and obtain a file descriptor from it.
|
||||||
@ -67,7 +66,7 @@ public class EpollDomainSocketFdTest extends AbstractSocketTest {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cb.handler(new ChannelInboundHandlerAdapter() {
|
cb.handler(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
FileDescriptor fd = (FileDescriptor) msg;
|
FileDescriptor fd = (FileDescriptor) msg;
|
||||||
|
@ -22,7 +22,7 @@ import io.netty.channel.ChannelFuture;
|
|||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerAdapter;
|
import io.netty.channel.ChannelHandlerAdapter;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.util.NetUtil;
|
import io.netty.util.NetUtil;
|
||||||
import io.netty.util.ReferenceCountUtil;
|
import io.netty.util.ReferenceCountUtil;
|
||||||
import io.netty.util.ResourceLeakDetector;
|
import io.netty.util.ResourceLeakDetector;
|
||||||
@ -200,7 +200,7 @@ public class EpollReuseAddrTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
private static class ServerSocketTestHandler extends ChannelInboundHandlerAdapter {
|
private static class ServerSocketTestHandler implements ChannelInboundHandler {
|
||||||
private final AtomicBoolean accepted;
|
private final AtomicBoolean accepted;
|
||||||
|
|
||||||
ServerSocketTestHandler(AtomicBoolean accepted) {
|
ServerSocketTestHandler(AtomicBoolean accepted) {
|
||||||
@ -215,7 +215,7 @@ public class EpollReuseAddrTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ChannelHandler.Sharable
|
@ChannelHandler.Sharable
|
||||||
private static class DatagramSocketTestHandler extends ChannelInboundHandlerAdapter {
|
private static class DatagramSocketTestHandler implements ChannelInboundHandler {
|
||||||
private final AtomicBoolean received;
|
private final AtomicBoolean received;
|
||||||
|
|
||||||
DatagramSocketTestHandler(AtomicBoolean received) {
|
DatagramSocketTestHandler(AtomicBoolean received) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
package io.netty.channel.epoll;
|
package io.netty.channel.epoll;
|
||||||
|
|
||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
@ -40,7 +40,7 @@ public class EpollServerSocketChannelConfigTest {
|
|||||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||||
ch = (EpollServerSocketChannel) bootstrap.group(group)
|
ch = (EpollServerSocketChannel) bootstrap.group(group)
|
||||||
.channel(EpollServerSocketChannel.class)
|
.channel(EpollServerSocketChannel.class)
|
||||||
.childHandler(new ChannelInboundHandlerAdapter())
|
.childHandler(new ChannelInboundHandler() { })
|
||||||
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import static org.junit.Assert.*;
|
|||||||
import static org.junit.Assume.*;
|
import static org.junit.Assume.*;
|
||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
import io.netty.channel.ChannelException;
|
import io.netty.channel.ChannelException;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ public class EpollSocketChannelConfigTest {
|
|||||||
Bootstrap bootstrap = new Bootstrap();
|
Bootstrap bootstrap = new Bootstrap();
|
||||||
ch = (EpollSocketChannel) bootstrap.group(group)
|
ch = (EpollSocketChannel) bootstrap.group(group)
|
||||||
.channel(EpollSocketChannel.class)
|
.channel(EpollSocketChannel.class)
|
||||||
.handler(new ChannelInboundHandlerAdapter())
|
.handler(new ChannelInboundHandler() { })
|
||||||
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
package io.netty.channel.epoll;
|
package io.netty.channel.epoll;
|
||||||
|
|
||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
@ -35,7 +35,7 @@ public class EpollSocketChannelTest {
|
|||||||
Bootstrap bootstrap = new Bootstrap();
|
Bootstrap bootstrap = new Bootstrap();
|
||||||
EpollSocketChannel ch = (EpollSocketChannel) bootstrap.group(group)
|
EpollSocketChannel ch = (EpollSocketChannel) bootstrap.group(group)
|
||||||
.channel(EpollSocketChannel.class)
|
.channel(EpollSocketChannel.class)
|
||||||
.handler(new ChannelInboundHandlerAdapter())
|
.handler(new ChannelInboundHandler() { })
|
||||||
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
||||||
EpollTcpInfo info = ch.tcpInfo();
|
EpollTcpInfo info = ch.tcpInfo();
|
||||||
assertTcpInfo0(info);
|
assertTcpInfo0(info);
|
||||||
@ -53,7 +53,7 @@ public class EpollSocketChannelTest {
|
|||||||
Bootstrap bootstrap = new Bootstrap();
|
Bootstrap bootstrap = new Bootstrap();
|
||||||
EpollSocketChannel ch = (EpollSocketChannel) bootstrap.group(group)
|
EpollSocketChannel ch = (EpollSocketChannel) bootstrap.group(group)
|
||||||
.channel(EpollSocketChannel.class)
|
.channel(EpollSocketChannel.class)
|
||||||
.handler(new ChannelInboundHandlerAdapter())
|
.handler(new ChannelInboundHandler() { })
|
||||||
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
||||||
EpollTcpInfo info = new EpollTcpInfo();
|
EpollTcpInfo info = new EpollTcpInfo();
|
||||||
ch.tcpInfo(info);
|
ch.tcpInfo(info);
|
||||||
@ -111,7 +111,7 @@ public class EpollSocketChannelTest {
|
|||||||
EpollSocketChannel ch = (EpollSocketChannel) bootstrap.group(group)
|
EpollSocketChannel ch = (EpollSocketChannel) bootstrap.group(group)
|
||||||
.channel(EpollSocketChannel.class)
|
.channel(EpollSocketChannel.class)
|
||||||
.option(ChannelOption.SO_LINGER, 10)
|
.option(ChannelOption.SO_LINGER, 10)
|
||||||
.handler(new ChannelInboundHandlerAdapter())
|
.handler(new ChannelInboundHandler() { })
|
||||||
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
||||||
ch.close().syncUninterruptibly();
|
ch.close().syncUninterruptibly();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -17,7 +17,7 @@ package io.netty.channel.epoll;
|
|||||||
|
|
||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.ConnectTimeoutException;
|
import io.netty.channel.ConnectTimeoutException;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
@ -55,7 +55,7 @@ public class EpollSocketTcpMd5Test {
|
|||||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||||
server = (EpollServerSocketChannel) bootstrap.group(GROUP)
|
server = (EpollServerSocketChannel) bootstrap.group(GROUP)
|
||||||
.channel(EpollServerSocketChannel.class)
|
.channel(EpollServerSocketChannel.class)
|
||||||
.childHandler(new ChannelInboundHandlerAdapter())
|
.childHandler(new ChannelInboundHandler() { })
|
||||||
.bind(new InetSocketAddress(NetUtil.LOCALHOST4, 0)).syncUninterruptibly().channel();
|
.bind(new InetSocketAddress(NetUtil.LOCALHOST4, 0)).syncUninterruptibly().channel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ public class EpollSocketTcpMd5Test {
|
|||||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||||
EpollServerSocketChannel ch = (EpollServerSocketChannel) bootstrap.group(GROUP)
|
EpollServerSocketChannel ch = (EpollServerSocketChannel) bootstrap.group(GROUP)
|
||||||
.channel(EpollServerSocketChannel.class)
|
.channel(EpollServerSocketChannel.class)
|
||||||
.childHandler(new ChannelInboundHandlerAdapter())
|
.childHandler(new ChannelInboundHandler() { })
|
||||||
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
||||||
|
|
||||||
ch.config().setOption(EpollChannelOption.TCP_MD5SIG,
|
ch.config().setOption(EpollChannelOption.TCP_MD5SIG,
|
||||||
@ -93,7 +93,7 @@ public class EpollSocketTcpMd5Test {
|
|||||||
|
|
||||||
EpollSocketChannel client = (EpollSocketChannel) new Bootstrap().group(GROUP)
|
EpollSocketChannel client = (EpollSocketChannel) new Bootstrap().group(GROUP)
|
||||||
.channel(EpollSocketChannel.class)
|
.channel(EpollSocketChannel.class)
|
||||||
.handler(new ChannelInboundHandlerAdapter())
|
.handler(new ChannelInboundHandler() { })
|
||||||
.option(EpollChannelOption.TCP_MD5SIG,
|
.option(EpollChannelOption.TCP_MD5SIG,
|
||||||
Collections.singletonMap(NetUtil.LOCALHOST4, BAD_KEY))
|
Collections.singletonMap(NetUtil.LOCALHOST4, BAD_KEY))
|
||||||
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000)
|
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000)
|
||||||
@ -108,7 +108,7 @@ public class EpollSocketTcpMd5Test {
|
|||||||
|
|
||||||
EpollSocketChannel client = (EpollSocketChannel) new Bootstrap().group(GROUP)
|
EpollSocketChannel client = (EpollSocketChannel) new Bootstrap().group(GROUP)
|
||||||
.channel(EpollSocketChannel.class)
|
.channel(EpollSocketChannel.class)
|
||||||
.handler(new ChannelInboundHandlerAdapter())
|
.handler(new ChannelInboundHandler() { })
|
||||||
.option(EpollChannelOption.TCP_MD5SIG,
|
.option(EpollChannelOption.TCP_MD5SIG,
|
||||||
Collections.singletonMap(NetUtil.LOCALHOST4, SERVER_KEY))
|
Collections.singletonMap(NetUtil.LOCALHOST4, SERVER_KEY))
|
||||||
.connect(server.localAddress()).syncUninterruptibly().channel();
|
.connect(server.localAddress()).syncUninterruptibly().channel();
|
||||||
|
@ -23,7 +23,7 @@ import io.netty.channel.Channel;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
@ -64,7 +64,7 @@ public class EpollSpliceTest {
|
|||||||
ServerBootstrap bs2 = new ServerBootstrap();
|
ServerBootstrap bs2 = new ServerBootstrap();
|
||||||
bs2.channel(EpollServerSocketChannel.class);
|
bs2.channel(EpollServerSocketChannel.class);
|
||||||
bs2.childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED);
|
bs2.childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED);
|
||||||
bs2.group(group).childHandler(new ChannelInboundHandlerAdapter() {
|
bs2.group(group).childHandler(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
||||||
ctx.channel().config().setAutoRead(false);
|
ctx.channel().config().setAutoRead(false);
|
||||||
@ -72,7 +72,7 @@ public class EpollSpliceTest {
|
|||||||
bs.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED);
|
bs.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED);
|
||||||
|
|
||||||
bs.channel(EpollSocketChannel.class);
|
bs.channel(EpollSocketChannel.class);
|
||||||
bs.group(ctx.channel().eventLoop()).handler(new ChannelInboundHandlerAdapter() {
|
bs.group(ctx.channel().eventLoop()).handler(new ChannelInboundHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext context) throws Exception {
|
public void channelActive(ChannelHandlerContext context) throws Exception {
|
||||||
final EpollSocketChannel ch = (EpollSocketChannel) ctx.channel();
|
final EpollSocketChannel ch = (EpollSocketChannel) ctx.channel();
|
||||||
@ -195,7 +195,7 @@ public class EpollSpliceTest {
|
|||||||
Bootstrap cb = new Bootstrap();
|
Bootstrap cb = new Bootstrap();
|
||||||
cb.group(group);
|
cb.group(group);
|
||||||
cb.channel(EpollSocketChannel.class);
|
cb.channel(EpollSocketChannel.class);
|
||||||
cb.handler(new ChannelInboundHandlerAdapter());
|
cb.handler(new ChannelInboundHandler() { });
|
||||||
Channel cc = cb.connect(sc.localAddress()).syncUninterruptibly().channel();
|
Channel cc = cb.connect(sc.localAddress()).syncUninterruptibly().channel();
|
||||||
|
|
||||||
for (int i = 0; i < data.length;) {
|
for (int i = 0; i < data.length;) {
|
||||||
@ -278,7 +278,7 @@ public class EpollSpliceTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SpliceHandler extends ChannelInboundHandlerAdapter {
|
private static class SpliceHandler implements ChannelInboundHandler {
|
||||||
private final File file;
|
private final File file;
|
||||||
|
|
||||||
volatile Channel channel;
|
volatile Channel channel;
|
||||||
|
@ -17,7 +17,7 @@ package io.netty.channel.kqueue;
|
|||||||
|
|
||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
import io.netty.channel.ChannelException;
|
import io.netty.channel.ChannelException;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandler;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
import io.netty.channel.MultithreadEventLoopGroup;
|
import io.netty.channel.MultithreadEventLoopGroup;
|
||||||
@ -80,7 +80,7 @@ public class KQueueChannelConfigTest {
|
|||||||
KQueueSocketChannel ch = (KQueueSocketChannel) bootstrap.group(group)
|
KQueueSocketChannel ch = (KQueueSocketChannel) bootstrap.group(group)
|
||||||
.channel(KQueueSocketChannel.class)
|
.channel(KQueueSocketChannel.class)
|
||||||
.option(ChannelOption.SO_LINGER, 10)
|
.option(ChannelOption.SO_LINGER, 10)
|
||||||
.handler(new ChannelInboundHandlerAdapter())
|
.handler(new ChannelInboundHandler() { })
|
||||||
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
||||||
ch.close().syncUninterruptibly();
|
ch.close().syncUninterruptibly();
|
||||||
} finally {
|
} finally {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user