< prev index next >
test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java
Print this page
@@ -24,11 +24,12 @@
/*
* @test
* @bug 8087112 8177935
* @library /lib/testlibrary server
* @build jdk.testlibrary.SimpleSSLContext
- * @modules jdk.incubator.httpclient/jdk.incubator.http.internal.common
+ * @modules java.base/sun.net.www.http
+ * jdk.incubator.httpclient/jdk.incubator.http.internal.common
* jdk.incubator.httpclient/jdk.incubator.http.internal.frame
* jdk.incubator.httpclient/jdk.incubator.http.internal.hpack
* @run testng/othervm -Djdk.httpclient.HttpClient.log=ssl,requests,responses,errors FixedThreadPoolTest
*/
@@ -37,12 +38,12 @@
import static jdk.incubator.http.HttpClient.Version.HTTP_2;
import javax.net.ssl.*;
import java.nio.file.*;
import java.util.concurrent.*;
import jdk.testlibrary.SimpleSSLContext;
-import static jdk.incubator.http.HttpRequest.BodyProcessor.fromFile;
-import static jdk.incubator.http.HttpRequest.BodyProcessor.fromString;
+import static jdk.incubator.http.HttpRequest.BodyPublisher.fromFile;
+import static jdk.incubator.http.HttpRequest.BodyPublisher.fromString;
import static jdk.incubator.http.HttpResponse.BodyHandler.asFile;
import static jdk.incubator.http.HttpResponse.BodyHandler.asString;
import org.testng.annotations.Test;
@@ -79,11 +80,11 @@
e.printStackTrace();
throw e;
}
}
- @Test(timeOut=3000000)
+ @Test
public static void test() throws Exception {
try {
initialize();
simpleTest(false);
simpleTest(true);
@@ -102,10 +103,17 @@
}
static HttpClient getClient() {
if (client == null) {
exec = Executors.newCachedThreadPool();
+ // Executor e1 = Executors.newFixedThreadPool(1);
+ // Executor e = (Runnable r) -> e1.execute(() -> {
+ // System.out.println("[" + Thread.currentThread().getName()
+ // + "] Executing: "
+ // + r.getClass().getName());
+ // r.run();
+ // });
client = HttpClient.newBuilder()
.executor(Executors.newFixedThreadPool(2))
.sslContext(sslContext)
.version(HTTP_2)
.build();
< prev index next >