Skip to content

Commit 1b63b9b

Browse files
committed
Fix AsyncEchoClient
1 parent c05a61b commit 1b63b9b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎core-java/src/test/java/com/baeldung/java/nio2/async/AsyncEchoClient.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ private void start() {
4040
}
4141
}
4242

43-
public String sendMessage(String message) {
44-
byte[] byteMsg = new String(message).getBytes();
43+
public String sendMessage(String message) throws Exception {
44+
byte[] byteMsg = message.getBytes();
4545
ByteBuffer buffer = ByteBuffer.wrap(byteMsg);
4646
Future<Integer> writeResult = client.write(buffer);
4747

@@ -65,7 +65,7 @@ public void stop() {
6565
}
6666
}
6767

68-
public static void main(String[] args) throws IOException {
68+
public static void main(String[] args) throws Exception {
6969
AsyncEchoClient client = AsyncEchoClient.getInstance();
7070
client.start();
7171
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

0 commit comments

Comments
 (0)