test/jdk/java/net/httpclient/MethodsTest.java
branchhttp-client-branch
changeset 56342 5c2ea761455b
parent 56261 a339fe1aab55
child 56451 9585061fdb04
--- a/test/jdk/java/net/httpclient/MethodsTest.java	Thu Mar 22 09:48:27 2018 +0000
+++ b/test/jdk/java/net/httpclient/MethodsTest.java	Thu Mar 22 14:45:30 2018 +0000
@@ -31,6 +31,8 @@
 import java.net.http.HttpResponse;
 import java.time.Duration;
 import java.util.Optional;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+
 
 /**
  * @test
@@ -42,6 +44,7 @@
 
     static final URI TEST_URI = URI.create("http://www.foo.com/");
     static final String FORBIDDEN = "()<>@,;:\\\"/[]?={} \t\r\n";
+    static final HttpClient client = HttpClient.newBuilder().proxy(NO_PROXY).build();
 
     static void bad(String name) throws IOException, InterruptedException {
         HttpRequest.Builder builder = HttpRequest.newBuilder(TEST_URI);
@@ -75,7 +78,7 @@
                     return new HttpHeadersImpl();
                 }
             };
-            HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
+            client.send(req, HttpResponse.BodyHandlers.ofString());
             throw new RuntimeException("Expected IAE for method:" + name);
         } catch (IllegalArgumentException expected) {
             System.out.println("Got expected IAE: " + expected);