|
@@ -1,10 +1,10 @@
|
|
|
package com.its.api.xnettcp.client;
|
|
package com.its.api.xnettcp.client;
|
|
|
|
|
|
|
|
-import com.its.utils.NettyUtils;
|
|
|
|
|
import com.its.api.xnettcp.client.codec.NettyTcpClientDecoder;
|
|
import com.its.api.xnettcp.client.codec.NettyTcpClientDecoder;
|
|
|
import com.its.api.xnettcp.client.codec.NettyTcpClientEncoder;
|
|
import com.its.api.xnettcp.client.codec.NettyTcpClientEncoder;
|
|
|
import com.its.api.xnettcp.client.handler.NettyTcpClientIdleHandler;
|
|
import com.its.api.xnettcp.client.handler.NettyTcpClientIdleHandler;
|
|
|
import com.its.api.xnettcp.client.handler.NettyTcpClientInboundHandler;
|
|
import com.its.api.xnettcp.client.handler.NettyTcpClientInboundHandler;
|
|
|
|
|
+import com.its.utils.NettyUtils;
|
|
|
import io.netty.bootstrap.Bootstrap;
|
|
import io.netty.bootstrap.Bootstrap;
|
|
|
import io.netty.channel.ChannelFuture;
|
|
import io.netty.channel.ChannelFuture;
|
|
|
import io.netty.channel.ChannelInitializer;
|
|
import io.netty.channel.ChannelInitializer;
|
|
@@ -12,6 +12,8 @@ import io.netty.channel.ChannelOption;
|
|
|
import io.netty.channel.EventLoopGroup;
|
|
import io.netty.channel.EventLoopGroup;
|
|
|
import io.netty.channel.socket.SocketChannel;
|
|
import io.netty.channel.socket.SocketChannel;
|
|
|
import io.netty.channel.socket.nio.NioSocketChannel;
|
|
import io.netty.channel.socket.nio.NioSocketChannel;
|
|
|
|
|
+import io.netty.handler.logging.LogLevel;
|
|
|
|
|
+import io.netty.handler.logging.LoggingHandler;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
@@ -47,6 +49,7 @@ public class NettyTcpClientVdsBootstrapFactory {
|
|
|
// 핸들러가 실행되는 순서는 추가된 순서에 의해 결정된다.(Inbound: head=>tail, Outbound: tail=>head, name2ctx)
|
|
// 핸들러가 실행되는 순서는 추가된 순서에 의해 결정된다.(Inbound: head=>tail, Outbound: tail=>head, name2ctx)
|
|
|
@Override
|
|
@Override
|
|
|
public void initChannel(SocketChannel ch) throws Exception {
|
|
public void initChannel(SocketChannel ch) throws Exception {
|
|
|
|
|
+ ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO));
|
|
|
ch.pipeline().addLast("vdsClientIdleHandler", new NettyTcpClientIdleHandler(0, 0, 0, TimeUnit.SECONDS));
|
|
ch.pipeline().addLast("vdsClientIdleHandler", new NettyTcpClientIdleHandler(0, 0, 0, TimeUnit.SECONDS));
|
|
|
ch.pipeline().addLast("vdsClientDecoder", new NettyTcpClientDecoder()); // Decoding handler
|
|
ch.pipeline().addLast("vdsClientDecoder", new NettyTcpClientDecoder()); // Decoding handler
|
|
|
ch.pipeline().addLast("vdsClientInboundHandler", new NettyTcpClientInboundHandler()); // Packet Inbound handler
|
|
ch.pipeline().addLast("vdsClientInboundHandler", new NettyTcpClientInboundHandler()); // Packet Inbound handler
|