diff --git a/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/TimeClient.java b/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/HelloClient.java similarity index 93% rename from whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/TimeClient.java rename to whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/HelloClient.java index 2c03391ba42259f2a6b04ff60619621fa9185eb6..1ae06a6293b727e3bce24f03a2112779368ddca2 100644 --- a/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/TimeClient.java +++ b/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/HelloClient.java @@ -12,7 +12,7 @@ import io.netty.channel.socket.nio.NioSocketChannel; /** * Created by shenhongxi on 2018/10/5. */ -public class TimeClient { +public class HelloClient { public void connect(int port, String host) throws Exception { // 配置客户端NIO线程组 @@ -24,7 +24,7 @@ public class TimeClient { .handler(new ChannelInitializer() { @Override protected void initChannel(SocketChannel socketChannel) throws Exception { - socketChannel.pipeline().addLast(new TimeClientHandler()); + socketChannel.pipeline().addLast(new HelloClientHandler()); } }); @@ -40,6 +40,6 @@ public class TimeClient { } public static void main(String[] args) throws Exception { - new TimeClient().connect(8080, "127.0.0.1"); + new HelloClient().connect(8080, "127.0.0.1"); } } diff --git a/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/TimeClientHandler.java b/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/HelloClientHandler.java similarity index 90% rename from whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/TimeClientHandler.java rename to whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/HelloClientHandler.java index fe9c526bdedf43ca0be090ea6307b2b053371c34..654279ec2ef72b19b87f33de1ab4d7cb96f51d84 100644 --- a/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/TimeClientHandler.java +++ b/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/HelloClientHandler.java @@ -8,11 +8,11 @@ import io.netty.channel.ChannelInboundHandlerAdapter; /** * Created by shenhongxi on 2018/10/5. */ -public class TimeClientHandler extends ChannelInboundHandlerAdapter { +public class HelloClientHandler extends ChannelInboundHandlerAdapter { private final ByteBuf firstMessage; - public TimeClientHandler() { + public HelloClientHandler() { byte[] req = "QUERY TIME COMMAND".getBytes(); firstMessage = Unpooled.buffer(req.length); firstMessage.writeBytes(req); diff --git a/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/TimeServer.java b/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/HelloServer.java similarity index 92% rename from whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/TimeServer.java rename to whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/HelloServer.java index a99c02afd547616956952d98c9e7f2d3fb025639..bfa7bb27eeb875a5938ef3a826e75a7d7c57d042 100644 --- a/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/TimeServer.java +++ b/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/HelloServer.java @@ -12,7 +12,7 @@ import io.netty.channel.socket.nio.NioServerSocketChannel; /** * Created by shenhongxi on 2018/10/5. */ -public class TimeServer { +public class HelloServer { public void bind(int port) throws Exception { // 配置服务端的NIO线程组 @@ -41,11 +41,11 @@ public class TimeServer { @Override protected void initChannel(SocketChannel socketChannel) throws Exception { - socketChannel.pipeline().addLast(new TimeServerHandler()); + socketChannel.pipeline().addLast(new HelloServerHandler()); } } public static void main(String[] args) throws Exception { - new TimeServer().bind(8080); + new HelloServer().bind(8080); } } diff --git a/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/TimeServerHandler.java b/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/HelloServerHandler.java similarity index 93% rename from whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/TimeServerHandler.java rename to whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/HelloServerHandler.java index b834a2a2fd942bfcf57aea2c29f453483e7cb38c..bf6324bb4f678867b7114068f0b1e8fb1c6fc9cf 100644 --- a/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/TimeServerHandler.java +++ b/whatsmars-remoting/src/main/java/org/hongxi/whatsmars/remoting/netty4/HelloServerHandler.java @@ -10,7 +10,7 @@ import java.util.Date; /** * Created by shenhongxi on 2018/10/5. */ -public class TimeServerHandler extends ChannelInboundHandlerAdapter { +public class HelloServerHandler extends ChannelInboundHandlerAdapter { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { ByteBuf buf = (ByteBuf) msg;