Fix AsyncEchoClient

This commit is contained in:
pivovarit 2016-12-03 10:57:49 +01:00
parent c05a61b91b
commit 1b63b9bf35
1 changed files with 3 additions and 3 deletions

View File

@ -40,8 +40,8 @@ public class AsyncEchoClient {
} }
} }
public String sendMessage(String message) { public String sendMessage(String message) throws Exception {
byte[] byteMsg = new String(message).getBytes(); byte[] byteMsg = message.getBytes();
ByteBuffer buffer = ByteBuffer.wrap(byteMsg); ByteBuffer buffer = ByteBuffer.wrap(byteMsg);
Future<Integer> writeResult = client.write(buffer); Future<Integer> 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(); AsyncEchoClient client = AsyncEchoClient.getInstance();
client.start(); client.start();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedReader br = new BufferedReader(new InputStreamReader(System.in));