fix 服务端添加心跳监听

This commit is contained in:
wujiawei 2024-01-08 16:51:53 +08:00
parent cbd0d7c954
commit cfb0adfc89
2 changed files with 2 additions and 2 deletions

View File

@ -27,6 +27,7 @@ public class NettyProxyAutoConfiguration {
Constant.serverIp = clientProxyConfigurationProperties.getServerIp();
Constant.serverPort = clientProxyConfigurationProperties.getServerPort();
Constant.realPort = serverProperties.getPort();
Constant.realPort = 28080;
log.info("netty客户端连接服务端IP:{},服务端端口:{},客户端自己的端口:{}",Constant.serverIp,Constant.serverPort,Constant.realPort);

View File

@ -4,7 +4,6 @@ import com.lazy.netty.proxy.msg.MyMsgDecoder;
import com.lazy.netty.proxy.msg.MyMsgEncoder;
import com.lazy.netty.proxy.server.handler.ClientHandler;
import com.lazy.netty.proxy.server.handler.HeartBeatServerHandler;
import com.lazy.netty.proxy.server.handler.LazyServerIdleStateHandler;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
@ -34,7 +33,7 @@ public class ServerSocket {
pipeline.addLast(new MyMsgDecoder(Integer.MAX_VALUE, 0, 4, -4, 0));
pipeline.addLast(new MyMsgEncoder());
pipeline.addLast(new IdleStateHandler(40, 10, 0));
pipeline.addLast(new LazyServerIdleStateHandler(40, 10, 0));
// pipeline.addLast(new LazyServerIdleStateHandler(40, 10, 0));
pipeline.addLast(new ClientHandler());
pipeline.addLast(new HeartBeatServerHandler());
}