From 1b63b9bf35798cc1740929b30ba31e73e31fc372 Mon Sep 17 00:00:00 2001 From: pivovarit Date: Sat, 3 Dec 2016 10:57:49 +0100 Subject: [PATCH] Fix AsyncEchoClient --- .../java/com/baeldung/java/nio2/async/AsyncEchoClient.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core-java/src/test/java/com/baeldung/java/nio2/async/AsyncEchoClient.java b/core-java/src/test/java/com/baeldung/java/nio2/async/AsyncEchoClient.java index d64fbc763e..eaaf3dea06 100644 --- a/core-java/src/test/java/com/baeldung/java/nio2/async/AsyncEchoClient.java +++ b/core-java/src/test/java/com/baeldung/java/nio2/async/AsyncEchoClient.java @@ -40,8 +40,8 @@ public class AsyncEchoClient { } } - public String sendMessage(String message) { - byte[] byteMsg = new String(message).getBytes(); + public String sendMessage(String message) throws Exception { + byte[] byteMsg = message.getBytes(); ByteBuffer buffer = ByteBuffer.wrap(byteMsg); Future writeResult = client.write(buffer); @@ -65,7 +65,7 @@ public class AsyncEchoClient { } } - public static void main(String[] args) throws IOException { + public static void main(String[] args) throws Exception { AsyncEchoClient client = AsyncEchoClient.getInstance(); client.start(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in));