1
1
package datadog .common .socket ;
2
2
3
+ import static org .junit .jupiter .api .Assertions .assertTimeoutPreemptively ;
4
+
3
5
import java .io .IOException ;
4
6
import java .net .InetSocketAddress ;
5
7
import java .net .StandardProtocolFamily ;
8
10
import java .nio .channels .SocketChannel ;
9
11
import java .nio .file .Files ;
10
12
import java .nio .file .Path ;
13
+ import java .time .Duration ;
11
14
import java .util .concurrent .atomic .AtomicBoolean ;
12
15
import org .junit .jupiter .api .Test ;
13
16
@@ -19,16 +22,16 @@ public class TunnelingJdkSocketTest {
19
22
20
23
@ Test
21
24
public void testTimeout () throws Exception {
22
- // Path socketPath = getSocketPath();
23
- // UnixDomainSocketAddress socketAddress = UnixDomainSocketAddress.of(socketPath);
24
- // startServer(socketAddress);
25
- // TunnelingJdkSocket clientSocket = createClient(socketPath);
26
- //
27
- // assertTimeoutPreemptively(
28
- // Duration.ofMillis(testTimeout), () -> clientSocket.getInputStream().read());
29
- //
30
- // clientSocket.close();
31
- // isServerRunning.set(false);
25
+ Path socketPath = getSocketPath ();
26
+ UnixDomainSocketAddress socketAddress = UnixDomainSocketAddress .of (socketPath );
27
+ startServer (socketAddress );
28
+ TunnelingJdkSocket clientSocket = createClient (socketPath );
29
+
30
+ assertTimeoutPreemptively (
31
+ Duration .ofMillis (testTimeout ), () -> clientSocket .getInputStream ().read ());
32
+
33
+ clientSocket .close ();
34
+ isServerRunning .set (false );
32
35
}
33
36
34
37
private Path getSocketPath () throws IOException {
0 commit comments