Fix AsyncEchoClient
This commit is contained in:
parent
c05a61b91b
commit
1b63b9bf35
|
@ -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));
|
||||||
|
|
Loading…
Reference in New Issue