http-client-branch: review comment - a few more test should explicitly set no proxy http-client-branch
authorchegar
Fri, 13 Apr 2018 14:59:22 +0100
branchhttp-client-branch
changeset 56425 9236d0fb75b9
parent 56424 c6fe988dca4c
child 56426 f39b316f10c9
http-client-branch: review comment - a few more test should explicitly set no proxy
test/jdk/java/net/httpclient/EncodedCharsInURI.java
test/jdk/java/net/httpclient/EscapedOctetsInURI.java
test/jdk/java/net/httpclient/StreamingBody.java
--- a/test/jdk/java/net/httpclient/EncodedCharsInURI.java	Fri Apr 13 14:54:02 2018 +0100
+++ b/test/jdk/java/net/httpclient/EncodedCharsInURI.java	Fri Apr 13 14:59:22 2018 +0100
@@ -88,6 +88,7 @@
 import static java.lang.System.in;
 import static java.lang.System.out;
 import static java.nio.charset.StandardCharsets.UTF_8;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
@@ -209,6 +210,7 @@
         clientCount.incrementAndGet();
         return HttpClient.newBuilder()
                 .executor(executor)
+                .proxy(NO_PROXY)
                 .sslContext(sslContext)
                 .build();
     }
--- a/test/jdk/java/net/httpclient/EscapedOctetsInURI.java	Fri Apr 13 14:54:02 2018 +0100
+++ b/test/jdk/java/net/httpclient/EscapedOctetsInURI.java	Fri Apr 13 14:59:22 2018 +0100
@@ -65,6 +65,7 @@
 import org.testng.annotations.Test;
 import static java.lang.System.out;
 import static java.nio.charset.StandardCharsets.US_ASCII;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
 import static org.testng.Assert.assertEquals;
 
 public class EscapedOctetsInURI {
@@ -123,7 +124,10 @@
         HttpClient client = null;
         for (int i=0; i< ITERATION_COUNT; i++) {
             if (!sameClient || client == null)
-                client = HttpClient.newBuilder().sslContext(sslContext).build();
+                client = HttpClient.newBuilder()
+                        .proxy(NO_PROXY)
+                        .sslContext(sslContext)
+                        .build();
 
             HttpRequest request = HttpRequest.newBuilder(uri).build();
             HttpResponse<String> resp = client.send(request, BodyHandlers.ofString());
@@ -147,7 +151,10 @@
         HttpClient client = null;
         for (int i=0; i< ITERATION_COUNT; i++) {
             if (!sameClient || client == null)
-                client = HttpClient.newBuilder().sslContext(sslContext).build();
+                client = HttpClient.newBuilder()
+                        .proxy(NO_PROXY)
+                        .sslContext(sslContext)
+                        .build();
 
             HttpRequest request = HttpRequest.newBuilder(uri).build();
 
--- a/test/jdk/java/net/httpclient/StreamingBody.java	Fri Apr 13 14:54:02 2018 +0100
+++ b/test/jdk/java/net/httpclient/StreamingBody.java	Fri Apr 13 14:59:22 2018 +0100
@@ -60,6 +60,7 @@
 import org.testng.annotations.Test;
 import static java.lang.System.out;
 import static java.nio.charset.StandardCharsets.UTF_8;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
 import static org.testng.Assert.assertEquals;
 
 public class StreamingBody implements HttpServerAdapters {
@@ -97,6 +98,7 @@
             out.println("iteration: " + i);
             HttpResponse<InputStream> response = HttpClient.newBuilder()
                     .sslContext(sslContext)
+                    .proxy(NO_PROXY)
                     .build()
                     .sendAsync(request, BodyHandlers.ofInputStream())
                     .join();