22 */ |
22 */ |
23 |
23 |
24 import java.io.IOException; |
24 import java.io.IOException; |
25 import java.net.ServerSocket; |
25 import java.net.ServerSocket; |
26 import java.net.URI; |
26 import java.net.URI; |
27 import jdk.incubator.http.HttpClient; |
27 import java.net.http.HttpClient; |
28 import jdk.incubator.http.HttpRequest; |
28 import java.net.http.HttpRequest; |
29 import jdk.incubator.http.HttpResponse; |
29 import java.net.http.HttpResponse; |
30 import jdk.incubator.http.HttpTimeoutException; |
30 import java.net.http.HttpTimeoutException; |
31 import java.time.Duration; |
31 import java.time.Duration; |
32 import java.util.concurrent.CompletableFuture; |
32 import java.util.concurrent.CompletableFuture; |
33 import java.util.concurrent.ExecutorService; |
33 import java.util.concurrent.ExecutorService; |
34 import java.util.concurrent.Executors; |
34 import java.util.concurrent.Executors; |
35 import java.util.concurrent.LinkedBlockingQueue; |
35 import java.util.concurrent.LinkedBlockingQueue; |
36 import static java.lang.System.out; |
36 import static java.lang.System.out; |
37 import static jdk.incubator.http.HttpResponse.BodyHandler.replace; |
37 import static java.net.http.HttpResponse.BodyHandler.replace; |
38 |
38 |
39 /** |
39 /** |
40 * @test |
40 * @test |
41 * @bug 8178147 |
41 * @bug 8178147 |
42 * @summary Ensures that small timeouts do not cause hangs due to race conditions |
42 * @summary Ensures that small timeouts do not cause hangs due to race conditions |
43 * @run main/othervm -Djdk.incubator.http.internal.common.DEBUG=true SmallTimeout |
43 * @run main/othervm -Djava.net.http.internal.common.DEBUG=true SmallTimeout |
44 */ |
44 */ |
45 |
45 |
46 // To enable logging use. Not enabled by default as it changes the dynamics |
46 // To enable logging use. Not enabled by default as it changes the dynamics |
47 // of the test. |
47 // of the test. |
48 // @run main/othervm -Djdk.httpclient.HttpClient.log=all,frames:all SmallTimeout |
48 // @run main/othervm -Djdk.httpclient.HttpClient.log=all,frames:all SmallTimeout |