Skip to content

Commit

Permalink
Move from ChannelInboundHandlerAdapter to ChannelHandlerAdapter
Browse files Browse the repository at this point in the history
Related to #1873
  • Loading branch information
violetagg committed May 20, 2022
1 parent 9e38056 commit c1ebbd9
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import io.netty.buffer.Unpooled;
import io.netty5.channel.Channel;
import io.netty5.channel.ChannelHandler;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import io.netty5.channel.ChannelPipeline;
import io.netty5.channel.nio.NioEventLoop;
import io.netty5.handler.ssl.SslHandler;
Expand Down Expand Up @@ -843,7 +843,7 @@ public String toString() {
* @author Simon Baslé
*/
@ChannelHandler.Sharable
static final class ExtractorHandler extends ChannelInboundHandlerAdapter {
static final class ExtractorHandler extends ChannelHandlerAdapter {


final BiConsumer<? super ChannelHandlerContext, Object> extractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package reactor.netty.channel;

import io.netty5.channel.ChannelHandler;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import io.netty5.channel.ChannelOutboundHandlerAdapter;
import io.netty5.channel.ChannelPromise;
import io.netty5.handler.ssl.SslHandler;
Expand Down Expand Up @@ -82,7 +82,7 @@ public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress,
}
}

static class TlsMetricsHandler extends ChannelInboundHandlerAdapter {
static class TlsMetricsHandler extends ChannelHandlerAdapter {
protected final ChannelMetricsRecorder recorder;
TlsMetricsHandler(ChannelMetricsRecorder recorder) {
this.recorder = recorder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import io.netty.buffer.EmptyByteBuf;
import io.netty.buffer.Unpooled;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import io.netty5.handler.codec.DecoderResult;
import io.netty5.handler.codec.DecoderResultProvider;
import io.netty5.util.IllegalReferenceCountException;
Expand All @@ -34,12 +34,12 @@
import static reactor.netty.ReactorNetty.toPrettyHexDump;

/**
* Netty {@link io.netty5.channel.ChannelDuplexHandler} implementation that bridge data
* Netty {@link io.netty5.channel.ChannelHandlerAdapter} implementation that bridge data
* via an IPC {@link NettyOutbound}
*
* @author Stephane Maldini
*/
final class ChannelOperationsHandler extends ChannelInboundHandlerAdapter {
final class ChannelOperationsHandler extends ChannelHandlerAdapter {

final ConnectionObserver listener;
final ChannelOperations.OnSetup opsFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import javax.net.ssl.SSLParameters;

import io.netty5.channel.Channel;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import io.netty5.channel.ChannelPipeline;
import io.netty5.handler.logging.LogLevel;
import io.netty5.handler.logging.LoggingHandler;
Expand Down Expand Up @@ -629,7 +629,7 @@ void addInternal(String domainName, Consumer<? super SslProvider.SslContextSpec>
}
}

static final class SslReadHandler extends ChannelInboundHandlerAdapter {
static final class SslReadHandler extends ChannelHandlerAdapter {
boolean handshakeDone;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import io.netty5.channel.ChannelConfig;
import io.netty5.channel.ChannelFutureListener;
import io.netty5.channel.ChannelHandler;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import io.netty5.channel.ChannelInitializer;
import io.netty5.channel.ChannelOption;
import io.netty5.channel.EventLoopGroup;
Expand Down Expand Up @@ -348,7 +348,7 @@ public Mono<Void> warmup() {

static final Logger log = Loggers.getLogger(ServerTransport.class);

static class Acceptor extends ChannelInboundHandlerAdapter {
static class Acceptor extends ChannelHandlerAdapter {

final EventLoopGroup childGroup;
final ChannelHandler childHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
import io.micrometer.core.instrument.Timer;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import io.micrometer.core.tck.MeterRegistryAssert;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -156,7 +156,7 @@ void testFailedConnect() throws Exception {
.port(port)
.doOnChannelInit((observer, channel, address) ->
channel.pipeline()
.addLast(new ChannelInboundHandlerAdapter() {
.addLast(new ChannelHandlerAdapter() {

@Override
public void channelUnregistered(ChannelHandlerContext ctx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty5.channel.AdaptiveRecvByteBufAllocator;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import io.netty5.channel.ChannelOption;
import io.netty5.channel.group.ChannelGroup;
import io.netty5.channel.group.DefaultChannelGroup;
Expand Down Expand Up @@ -1125,7 +1125,7 @@ void testSniSupport() throws Exception {
.addSniMapping("*.test.com", domainSpec -> domainSpec.sslContext(testTcpSslContextSpec)))
.doOnChannelInit((obs, channel, remoteAddress) ->
channel.pipeline()
.addAfter(NettyPipeline.SslHandler, "test", new ChannelInboundHandlerAdapter() {
.addAfter(NettyPipeline.SslHandler, "test", new ChannelHandlerAdapter() {
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof SniCompletionEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import io.netty5.channel.ChannelHandler;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import io.netty5.channel.ChannelInitializer;
import io.netty5.channel.ChannelOption;
import io.netty5.channel.ChannelPipeline;
Expand Down Expand Up @@ -840,7 +839,7 @@ else if (metricsRecorder instanceof ContextAwareHttpClientMetricsRecorder) {
}
}

static final class H2OrHttp11Codec extends ChannelInboundHandlerAdapter {
static final class H2OrHttp11Codec extends ChannelHandlerAdapter {
final boolean acceptGzip;
final HttpResponseDecoderSpec decoder;
final Http2Settings http2Settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package reactor.netty.http.client;

import io.netty5.channel.Channel;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import io.netty5.handler.codec.http2.Http2SettingsFrame;
import reactor.netty.Connection;
import reactor.netty.ConnectionObserver;
Expand All @@ -32,14 +32,14 @@
import static reactor.netty.ReactorNetty.format;

/**
* {@link ChannelInboundHandlerAdapter} prior {@link reactor.netty.channel.ChannelOperationsHandler}
* {@link ChannelHandlerAdapter} prior {@link reactor.netty.channel.ChannelOperationsHandler}
* for handling H2/H2C use cases. HTTP/1.x use cases are delegated to
* {@link reactor.netty.channel.ChannelOperationsHandler} without any interference.
*
* @author Violeta Georgieva
* @since 1.0.0
*/
final class HttpTrafficHandler extends ChannelInboundHandlerAdapter {
final class HttpTrafficHandler extends ChannelHandlerAdapter {
final ConnectionObserver listener;

HttpTrafficHandler(ConnectionObserver listener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import java.net.SocketAddress;

import io.netty5.channel.Channel;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import io.netty.contrib.handler.codec.haproxy.HAProxyMessage;
import io.netty5.util.AttributeKey;
import reactor.netty.transport.AddressUtils;
Expand All @@ -32,7 +32,7 @@
*
* @author aftersss
*/
final class HAProxyMessageReader extends ChannelInboundHandlerAdapter {
final class HAProxyMessageReader extends ChannelHandlerAdapter {

private static final AttributeKey<InetSocketAddress> REMOTE_ADDRESS_FROM_PROXY_PROTOCOL =
AttributeKey.valueOf("remoteAddressFromProxyProtocol");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package reactor.netty.http.server;

import io.netty5.channel.ChannelFutureListener;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import io.netty5.handler.codec.http.DefaultFullHttpResponse;
import io.netty5.handler.codec.http.HttpRequest;
import io.netty5.handler.codec.http.HttpResponse;
Expand All @@ -39,7 +39,7 @@
* @author James Chen
* @since 1.0.5
*/
final class NonSslRedirectHandler extends ChannelInboundHandlerAdapter {
final class NonSslRedirectHandler extends ChannelHandlerAdapter {

private static final String HTTP_PROTOCOL = "http://";
private static final String HTTPS_PROTOCOL = "https://";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package reactor.netty.http.client;

import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.unix.DomainSocketAddress;
import io.netty5.handler.codec.http.HttpResponseStatus;
import java.security.cert.CertificateException;
Expand All @@ -29,7 +30,6 @@
import java.util.concurrent.atomic.AtomicReference;

import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import io.netty5.handler.codec.http.HttpContent;
import io.netty5.handler.codec.http.HttpHeaderNames;
import io.netty5.handler.codec.http.HttpMethod;
Expand Down Expand Up @@ -700,7 +700,7 @@ private void doTestBuffersForRedirectWithContentShouldBeReleased(String redirect
ConnectionProvider provider = ConnectionProvider.create("doTestBuffersForRedirectWithContentShouldBeReleased", 1);
final List<Integer> redirectBufferRefCounts = new ArrayList<>();
HttpClient.create(provider)
.doOnRequest((r, c) -> c.addHandlerLast("test-buffer-released", new ChannelInboundHandlerAdapter() {
.doOnRequest((r, c) -> c.addHandlerLast("test-buffer-released", new ChannelHandlerAdapter() {

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.Unpooled;
import io.netty5.channel.Channel;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.ChannelInboundHandlerAdapter;
import io.netty5.channel.embedded.EmbeddedChannel;
import io.netty5.channel.group.DefaultChannelGroup;
import io.netty5.channel.unix.DomainSocketAddress;
Expand Down Expand Up @@ -1041,7 +1041,7 @@ private static byte[] compress(byte[] body) {
void testCustomHandlerInvokedBeforeIOHandler() {
disposableServer =
createServer()
.doOnConnection(c -> c.addHandlerFirst("custom", new ChannelInboundHandlerAdapter() {
.doOnConnection(c -> c.addHandlerFirst("custom", new ChannelHandlerAdapter() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof HttpRequest) {
Expand Down Expand Up @@ -1444,7 +1444,7 @@ void testDecodingFailureLastHttpContent() throws Exception {
disposableServer =
createServer()
.doOnConnection(conn -> conn.channel().pipeline().addAfter(NettyPipeline.HttpTrafficHandler, null,
new ChannelInboundHandlerAdapter() {
new ChannelHandlerAdapter() {

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
Expand Down Expand Up @@ -1826,7 +1826,7 @@ void testSniSupport() throws Exception {
.addSniMapping("*.test.com", domainSpec -> domainSpec.sslContext(testSslContextBuilder)))
.doOnChannelInit((obs, channel, remoteAddress) ->
channel.pipeline()
.addAfter(NettyPipeline.SslHandler, "test", new ChannelInboundHandlerAdapter() {
.addAfter(NettyPipeline.SslHandler, "test", new ChannelHandlerAdapter() {
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof SniCompletionEvent) {
Expand Down Expand Up @@ -1873,7 +1873,7 @@ void testSniSupportAsyncMappings() throws Exception {
.setSniAsyncMappings((input, promise) -> promise.setSuccess(testSslProvider)))
.doOnChannelInit((obs, channel, remoteAddress) ->
channel.pipeline()
.addAfter(NettyPipeline.SslHandler, "test", new ChannelInboundHandlerAdapter() {
.addAfter(NettyPipeline.SslHandler, "test", new ChannelHandlerAdapter() {
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof SniCompletionEvent) {
Expand Down

0 comments on commit c1ebbd9

Please sign in to comment.