@@ -0,0 +1,1805 @@
+package pro.simpleproject.core.intra.client;%0A%0Aimport io.netty.bootstrap.Bootstrap;%0Aimport io.netty.channel.Channel;%0Aimport io.netty.channel.ChannelInitializer;%0Aimport io.netty.channel.ChannelPipeline;%0Aimport io.netty.channel.EventLoopGroup;%0Aimport io.netty.channel.nio.NioEventLoopGroup;%0Aimport io.netty.channel.socket.SocketChannel;%0Aimport io.netty.channel.socket.nio.NioSocketChannel;%0Aimport io.netty.handler.ssl.SslContext;%0Aimport io.netty.handler.ssl.SslContextBuilder;%0Aimport io.netty.handler.ssl.util.InsecureTrustManagerFactory;%0Aimport io.netty.handler.timeout.IdleStateHandler;%0A%0Apublic class Client %7B%0A%0A%09private String host;%0A%09private int port;%0A%09private EventLoopGroup group;%0A%09private Channel channel;%0A%09private SslContext sslCtx;%0A%0A%09public Client(String host, int port) %7B%0A%09%09this.host = host;%0A%09%09this.port = port;%0A%09%09group = new NioEventLoopGroup();%0A%09%09try %7B%0A%09%09%09sslCtx = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build();%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%7D%0A%0A%09private void init() %7B%0A%09%09Bootstrap b = new Bootstrap();%0A%09%09b.group(group).channel(NioSocketChannel.class).handler(new ChannelInitializer%3CSocketChannel%3E() %7B%0A%09%09%09@Override%0A%09%09%09protected void initChannel(SocketChannel ch) throws Exception %7B%0A%09%09%09%09ChannelPipeline p = ch.pipeline();%0A%09%09%09%09p.addLast(sslCtx.newHandler(ch.alloc()));%0A%09%09%09%09p.addLast(new IdleStateHandler(5, 0, 0));%0A%09%09%09%7D%0A%09%09%7D);%0A%09%09try %7B%0A%09%09%09channel = b.connect(host, port).sync().channel();%0A%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%7D%0A%0A%09public boolean run(Object o) %7B%0A%09%09if (channel == null %7C%7C !channel.isActive()) %7B%0A%09%09%09init();%0A%09%09%7D%0A%09%09channel.writeAndFlush(o);%0A%09%09return true;%0A%09%7D%0A%0A%09public void close() %7B%0A%09%09if (channel != null) %7B%0A%09%09%09channel.close();%0A%09%09%7D%0A%09%09if (group != null) %7B%0A%09%09%09group.shutdownGracefully();%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

Create Client.java