diff --git a/remote/src/main/scala/org/apache/pekko/remote/transport/netty/NettyHelpers.scala b/remote/src/main/scala/org/apache/pekko/remote/transport/netty/NettyHelpers.scala index 8e3a7c55a02..eddec5b82c3 100644 --- a/remote/src/main/scala/org/apache/pekko/remote/transport/netty/NettyHelpers.scala +++ b/remote/src/main/scala/org/apache/pekko/remote/transport/netty/NettyHelpers.scala @@ -52,15 +52,16 @@ private[netty] trait NettyHelpers { /** * INTERNAL API */ -private[netty] trait NettyServerHelpers extends SimpleChannelInboundHandler[ByteBuf] with NettyHelpers { - +private[netty] abstract class NettyChannelHandlerAdapter extends SimpleChannelInboundHandler[ByteBuf] + with NettyHelpers { final override def channelRead0(ctx: ChannelHandlerContext, msg: ByteBuf): Unit = { onMessage(ctx, msg) } @nowarn("msg=deprecated") - final override def exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable): Unit = + final override def exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable): Unit = { transformException(ctx, cause) + } final override def channelActive(ctx: ChannelHandlerContext): Unit = { onOpen(ctx) @@ -75,23 +76,9 @@ private[netty] trait NettyServerHelpers extends SimpleChannelInboundHandler[Byte /** * INTERNAL API */ -private[netty] trait NettyClientHelpers extends SimpleChannelInboundHandler[ByteBuf] with NettyHelpers { - - final override def channelRead0(ctx: ChannelHandlerContext, msg: ByteBuf): Unit = { - onMessage(ctx, msg) - } - - @nowarn("msg=deprecated") - final override def exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable): Unit = { - transformException(ctx, cause) - } +private[netty] trait NettyServerHelpers extends NettyChannelHandlerAdapter - final override def channelActive(ctx: ChannelHandlerContext): Unit = { - onOpen(ctx) - onConnect(ctx) - } - - final override def channelInactive(ctx: ChannelHandlerContext): Unit = { - onDisconnect(ctx) - } -} +/** + * INTERNAL API + */ +private[netty] trait NettyClientHelpers extends NettyChannelHandlerAdapter