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

fix:控制台输入

上级 1b121ba4
...@@ -37,9 +37,9 @@ public class TestEventLoop_05_ChannelFuture { ...@@ -37,9 +37,9 @@ public class TestEventLoop_05_ChannelFuture {
}) })
//连接到服务器 //连接到服务器
.connect(new InetSocketAddress("localhost", 8080)); .connect(new InetSocketAddress("localhost", 8080));
final Channel channel = channelFuture.sync().channel(); Channel channel = channelFuture.sync().channel();
new Thread(() -> { new Thread(() -> {
final Scanner scanner = new Scanner(System.in, "UTF)"); final Scanner scanner = new Scanner(System.in);
while (true) { while (true) {
final String line = scanner.nextLine(); final String line = scanner.nextLine();
if ("q".equals(line)) { if ("q".equals(line)) {
...@@ -48,6 +48,6 @@ public class TestEventLoop_05_ChannelFuture { ...@@ -48,6 +48,6 @@ public class TestEventLoop_05_ChannelFuture {
} }
channel.writeAndFlush(line); channel.writeAndFlush(line);
} }
}); }, "input").start();
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册