提交 1baab088 编写于 作者: 檀越@新空间's avatar 檀越@新空间 🐭

fix:出入栈处理器

上级 052c633a
...@@ -3,6 +3,13 @@ package com.kwan.shuyu.demo; ...@@ -3,6 +3,13 @@ package com.kwan.shuyu.demo;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInboundHandlerAdapter;
/**
* 异常处理器
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/8/24 14:29
*/
public class EchoExceptionHandler extends ChannelInboundHandlerAdapter { public class EchoExceptionHandler extends ChannelInboundHandlerAdapter {
@Override @Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
......
...@@ -7,6 +7,14 @@ import io.netty.channel.ChannelOutboundHandlerAdapter; ...@@ -7,6 +7,14 @@ import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise; import io.netty.channel.ChannelPromise;
import io.netty.util.CharsetUtil; import io.netty.util.CharsetUtil;
/**
* 出栈处理器
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/8/24 14:28
*/
public class EchoOutSelfHandler extends ChannelOutboundHandlerAdapter { public class EchoOutSelfHandler extends ChannelOutboundHandlerAdapter {
@Override @Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
...@@ -22,7 +30,6 @@ public class EchoOutSelfHandler extends ChannelOutboundHandlerAdapter { ...@@ -22,7 +30,6 @@ public class EchoOutSelfHandler extends ChannelOutboundHandlerAdapter {
} }
}); });
} }
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
System.out.println("im in"); System.out.println("im in");
......
...@@ -7,6 +7,13 @@ import io.netty.channel.ChannelInboundHandlerAdapter; ...@@ -7,6 +7,13 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.util.CharsetUtil; import io.netty.util.CharsetUtil;
/**
* 入栈处理器
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/8/24 14:29
*/
@ChannelHandler.Sharable @ChannelHandler.Sharable
public class EchoServerHandler extends ChannelInboundHandlerAdapter { public class EchoServerHandler extends ChannelInboundHandlerAdapter {
@Override @Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册