Skip to content

Commit b4f05d4

Browse files
Merge remote-tracking branch 'origin/master'
Conflicts: core-java/src/test/java/com/baeldung/java/nio2/async/AsyncEchoClient.java core-java/src/test/java/com/baeldung/java/nio2/async/AsyncEchoTest.java
2 parents 1a7f172 + 6304f20 commit b4f05d4

2 files changed

Lines changed: 8 additions & 9 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) throws ExecutionException, InterruptedException {
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, ExecutionException, InterruptedException {
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));

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package com.baeldung.java.nio2.async;
22

3-
import static org.junit.Assert.*;
4-
5-
import java.io.IOException;
6-
import java.util.concurrent.ExecutionException;
7-
83
import org.junit.After;
94
import org.junit.Before;
105
import org.junit.Test;
116

7+
import java.io.IOException;
8+
9+
import static org.junit.Assert.assertEquals;
10+
1211
public class AsyncEchoTest {
1312

1413
Process server;
@@ -21,7 +20,7 @@ public void setup() throws IOException, InterruptedException {
2120
}
2221

2322
@Test
24-
public void givenServerClient_whenServerEchosMessage_thenCorrect() throws ExecutionException, InterruptedException {
23+
public void givenServerClient_whenServerEchosMessage_thenCorrect() throws Exception {
2524
String resp1 = client.sendMessage("hello");
2625
String resp2 = client.sendMessage("world");
2726
assertEquals("hello", resp1);

0 commit comments

Comments
 (0)