http-client-branch: set NO_PROXY in several WebSocket tests http-client-branch
authorchegar
Thu, 26 Apr 2018 14:42:36 +0100
branchhttp-client-branch
changeset 56486 b664a887e277
parent 56483 ff806eb4a2a4
child 56487 6fc81d0648aa
http-client-branch: set NO_PROXY in several WebSocket tests
test/jdk/java/net/httpclient/websocket/PendingBinaryPingClose.java
test/jdk/java/net/httpclient/websocket/PendingBinaryPongClose.java
test/jdk/java/net/httpclient/websocket/PendingPingBinaryClose.java
test/jdk/java/net/httpclient/websocket/PendingPingTextClose.java
test/jdk/java/net/httpclient/websocket/PendingPongBinaryClose.java
test/jdk/java/net/httpclient/websocket/PendingPongTextClose.java
test/jdk/java/net/httpclient/websocket/PendingTextPingClose.java
test/jdk/java/net/httpclient/websocket/PendingTextPongClose.java
test/jdk/java/net/httpclient/websocket/SendTest.java
test/jdk/java/net/httpclient/websocket/WSHandshakeExceptionTest.java
test/jdk/java/net/httpclient/websocket/WebSocketExtendedTest.java
test/jdk/java/net/httpclient/websocket/WebSocketTest.java
--- a/test/jdk/java/net/httpclient/websocket/PendingBinaryPingClose.java	Thu Apr 26 14:11:03 2018 +0100
+++ b/test/jdk/java/net/httpclient/websocket/PendingBinaryPingClose.java	Thu Apr 26 14:42:36 2018 +0100
@@ -37,8 +37,8 @@
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-
-import static java.net.http.HttpClient.newHttpClient;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+import static java.net.http.HttpClient.newBuilder;
 
 public class PendingBinaryPingClose extends PendingOperations {
 
@@ -51,7 +51,7 @@
         repeatable(() -> {
             server = Support.notReadingServer();
             server.open();
-            webSocket = newHttpClient().newWebSocketBuilder()
+            webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
             ByteBuffer data = ByteBuffer.allocate(65536);
--- a/test/jdk/java/net/httpclient/websocket/PendingBinaryPongClose.java	Thu Apr 26 14:11:03 2018 +0100
+++ b/test/jdk/java/net/httpclient/websocket/PendingBinaryPongClose.java	Thu Apr 26 14:42:36 2018 +0100
@@ -37,8 +37,8 @@
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-
-import static java.net.http.HttpClient.newHttpClient;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+import static java.net.http.HttpClient.newBuilder;
 
 public class PendingBinaryPongClose extends PendingOperations {
 
@@ -51,7 +51,7 @@
         repeatable(() -> {
             server = Support.notReadingServer();
             server.open();
-            webSocket = newHttpClient().newWebSocketBuilder()
+            webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
             ByteBuffer data = ByteBuffer.allocate(65536);
--- a/test/jdk/java/net/httpclient/websocket/PendingPingBinaryClose.java	Thu Apr 26 14:11:03 2018 +0100
+++ b/test/jdk/java/net/httpclient/websocket/PendingPingBinaryClose.java	Thu Apr 26 14:42:36 2018 +0100
@@ -39,8 +39,8 @@
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-
-import static java.net.http.HttpClient.newHttpClient;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+import static java.net.http.HttpClient.newBuilder;
 
 public class PendingPingBinaryClose extends PendingOperations {
 
@@ -53,7 +53,7 @@
         repeatable( () -> {
             server = Support.notReadingServer();
             server.open();
-            webSocket = newHttpClient().newWebSocketBuilder()
+            webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
             ByteBuffer data = ByteBuffer.allocate(125);
--- a/test/jdk/java/net/httpclient/websocket/PendingPingTextClose.java	Thu Apr 26 14:11:03 2018 +0100
+++ b/test/jdk/java/net/httpclient/websocket/PendingPingTextClose.java	Thu Apr 26 14:42:36 2018 +0100
@@ -39,8 +39,8 @@
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-
-import static java.net.http.HttpClient.newHttpClient;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+import static java.net.http.HttpClient.newBuilder;
 
 public class PendingPingTextClose extends PendingOperations {
 
@@ -53,7 +53,7 @@
         repeatable( () -> {
             server = Support.notReadingServer();
             server.open();
-            webSocket = newHttpClient().newWebSocketBuilder()
+            webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
             ByteBuffer data = ByteBuffer.allocate(125);
--- a/test/jdk/java/net/httpclient/websocket/PendingPongBinaryClose.java	Thu Apr 26 14:11:03 2018 +0100
+++ b/test/jdk/java/net/httpclient/websocket/PendingPongBinaryClose.java	Thu Apr 26 14:42:36 2018 +0100
@@ -39,8 +39,8 @@
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-
-import static java.net.http.HttpClient.newHttpClient;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+import static java.net.http.HttpClient.newBuilder;
 
 public class PendingPongBinaryClose extends PendingOperations {
 
@@ -53,7 +53,7 @@
         repeatable( () -> {
             server = Support.notReadingServer();
             server.open();
-            webSocket = newHttpClient().newWebSocketBuilder()
+            webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
             ByteBuffer data = ByteBuffer.allocate(125);
--- a/test/jdk/java/net/httpclient/websocket/PendingPongTextClose.java	Thu Apr 26 14:11:03 2018 +0100
+++ b/test/jdk/java/net/httpclient/websocket/PendingPongTextClose.java	Thu Apr 26 14:42:36 2018 +0100
@@ -40,6 +40,8 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+import static java.net.http.HttpClient.newBuilder;
 import static java.net.http.HttpClient.newHttpClient;
 
 public class PendingPongTextClose extends PendingOperations {
@@ -53,7 +55,7 @@
         repeatable( () -> {
             server = Support.notReadingServer();
             server.open();
-            webSocket = newHttpClient().newWebSocketBuilder()
+            webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
             ByteBuffer data = ByteBuffer.allocate(125);
--- a/test/jdk/java/net/httpclient/websocket/PendingTextPingClose.java	Thu Apr 26 14:11:03 2018 +0100
+++ b/test/jdk/java/net/httpclient/websocket/PendingTextPingClose.java	Thu Apr 26 14:42:36 2018 +0100
@@ -38,8 +38,8 @@
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-
-import static java.net.http.HttpClient.newHttpClient;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+import static java.net.http.HttpClient.newBuilder;
 
 public class PendingTextPingClose extends PendingOperations {
 
@@ -52,7 +52,7 @@
         repeatable(() -> {
             server = Support.notReadingServer();
             server.open();
-            webSocket = newHttpClient().newWebSocketBuilder()
+            webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
             CharBuffer data = CharBuffer.allocate(65536);
--- a/test/jdk/java/net/httpclient/websocket/PendingTextPongClose.java	Thu Apr 26 14:11:03 2018 +0100
+++ b/test/jdk/java/net/httpclient/websocket/PendingTextPongClose.java	Thu Apr 26 14:42:36 2018 +0100
@@ -38,8 +38,8 @@
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-
-import static java.net.http.HttpClient.newHttpClient;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+import static java.net.http.HttpClient.newBuilder;
 
 public class PendingTextPongClose extends PendingOperations {
 
@@ -52,7 +52,7 @@
         repeatable(() -> {
             server = Support.notReadingServer();
             server.open();
-            webSocket = newHttpClient().newWebSocketBuilder()
+            webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
             CharBuffer data = CharBuffer.allocate(65536);
--- a/test/jdk/java/net/httpclient/websocket/SendTest.java	Thu Apr 26 14:11:03 2018 +0100
+++ b/test/jdk/java/net/httpclient/websocket/SendTest.java	Thu Apr 26 14:42:36 2018 +0100
@@ -35,7 +35,8 @@
 import java.io.IOException;
 import java.net.http.WebSocket;
 
-import static java.net.http.HttpClient.newHttpClient;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+import static java.net.http.HttpClient.newBuilder;
 import static java.net.http.WebSocket.NORMAL_CLOSURE;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertThrows;
@@ -58,7 +59,7 @@
     public void sendMethodsThrowNPE() throws IOException {
         server = new DummyWebSocketServer();
         server.open();
-        webSocket = newHttpClient().newWebSocketBuilder()
+        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                 .buildAsync(server.getURI(), new WebSocket.Listener() { })
                 .join();
 
@@ -89,7 +90,7 @@
     public void sendCloseCompleted() throws IOException {
         server = new DummyWebSocketServer();
         server.open();
-        webSocket = newHttpClient().newWebSocketBuilder()
+        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                 .buildAsync(server.getURI(), new WebSocket.Listener() { })
                 .join();
         webSocket.sendClose(NORMAL_CLOSURE, "").join();
--- a/test/jdk/java/net/httpclient/websocket/WSHandshakeExceptionTest.java	Thu Apr 26 14:11:03 2018 +0100
+++ b/test/jdk/java/net/httpclient/websocket/WSHandshakeExceptionTest.java	Thu Apr 26 14:42:36 2018 +0100
@@ -51,6 +51,8 @@
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+
+import static java.net.http.HttpClient.Builder.NO_PROXY;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.fail;
@@ -79,6 +81,7 @@
 
     HttpClient newHttpClient() {
         return HttpClient.newBuilder()
+                         .proxy(NO_PROXY)
                          .executor(executor)
                          .sslContext(sslContext)
                          .build();
--- a/test/jdk/java/net/httpclient/websocket/WebSocketExtendedTest.java	Thu Apr 26 14:11:03 2018 +0100
+++ b/test/jdk/java/net/httpclient/websocket/WebSocketExtendedTest.java	Thu Apr 26 14:42:36 2018 +0100
@@ -43,8 +43,8 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
-
-import static java.net.http.HttpClient.newHttpClient;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+import static java.net.http.HttpClient.newBuilder;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
@@ -71,7 +71,7 @@
     public void binary(ByteBuffer expected) throws IOException, InterruptedException {
         try (DummyWebSocketServer server = new DummyWebSocketServer()) {
             server.open();
-            WebSocket ws = newHttpClient()
+            WebSocket ws = newBuilder().proxy(NO_PROXY).build()
                     .newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
@@ -166,7 +166,7 @@
     public void ping(ByteBuffer expected) throws Exception {
         try (DummyWebSocketServer server = new DummyWebSocketServer()) {
             server.open();
-            WebSocket ws = newHttpClient()
+            WebSocket ws = newBuilder().proxy(NO_PROXY).build()
                     .newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
@@ -188,7 +188,7 @@
     public void pong(ByteBuffer expected) throws Exception {
         try (DummyWebSocketServer server = new DummyWebSocketServer()) {
             server.open();
-            WebSocket ws = newHttpClient()
+            WebSocket ws = newBuilder().proxy(NO_PROXY).build()
                     .newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
@@ -210,7 +210,7 @@
     public void close(int statusCode, String reason) throws Exception {
         try (DummyWebSocketServer server = new DummyWebSocketServer()) {
             server.open();
-            WebSocket ws = newHttpClient()
+            WebSocket ws = newBuilder().proxy(NO_PROXY).build()
                     .newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
@@ -233,7 +233,7 @@
     public void text(String expected) throws Exception {
         try (DummyWebSocketServer server = new DummyWebSocketServer()) {
             server.open();
-            WebSocket ws = newHttpClient()
+            WebSocket ws = newBuilder().proxy(NO_PROXY).build()
                     .newWebSocketBuilder()
                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
                     .join();
--- a/test/jdk/java/net/httpclient/websocket/WebSocketTest.java	Thu Apr 26 14:11:03 2018 +0100
+++ b/test/jdk/java/net/httpclient/websocket/WebSocketTest.java	Thu Apr 26 14:42:36 2018 +0100
@@ -42,8 +42,8 @@
 import java.util.concurrent.CompletionStage;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
-
-import static java.net.http.HttpClient.newHttpClient;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+import static java.net.http.HttpClient.newBuilder;
 import static java.net.http.WebSocket.NORMAL_CLOSURE;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertThrows;
@@ -73,7 +73,7 @@
     public void illegalArgument() throws IOException {
         server = new DummyWebSocketServer();
         server.open();
-        webSocket = newHttpClient()
+        webSocket = newBuilder().proxy(NO_PROXY).build()
                 .newWebSocketBuilder()
                 .buildAsync(server.getURI(), new WebSocket.Listener() { })
                 .join();
@@ -137,7 +137,7 @@
     public void partialBinaryThenText() throws IOException {
         server = new DummyWebSocketServer();
         server.open();
-        webSocket = newHttpClient().newWebSocketBuilder()
+        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                 .buildAsync(server.getURI(), new WebSocket.Listener() { })
                 .join();
         webSocket.sendBinary(ByteBuffer.allocate(16), false).join();
@@ -152,7 +152,7 @@
     public void partialTextThenBinary() throws IOException {
         server = new DummyWebSocketServer();
         server.open();
-        webSocket = newHttpClient().newWebSocketBuilder()
+        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                 .buildAsync(server.getURI(), new WebSocket.Listener() { })
                 .join();
 
@@ -168,7 +168,7 @@
     public void sendMethodsThrowIOE1() throws IOException {
         server = new DummyWebSocketServer();
         server.open();
-        webSocket = newHttpClient()
+        webSocket = newBuilder().proxy(NO_PROXY).build()
                 .newWebSocketBuilder()
                 .buildAsync(server.getURI(), new WebSocket.Listener() { })
                 .join();
@@ -221,7 +221,7 @@
             }
         };
 
-        webSocket = newHttpClient().newWebSocketBuilder()
+        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                 .buildAsync(server.getURI(), listener)
                 .join();
 
@@ -333,7 +333,7 @@
             }
         };
 
-        webSocket = newHttpClient().newWebSocketBuilder()
+        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                 .buildAsync(server.getURI(), listener)
                 .join();
 
@@ -407,7 +407,7 @@
             }
         };
 
-        webSocket = newHttpClient().newWebSocketBuilder()
+        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                 .buildAsync(server.getURI(), listener)
                 .join();
 
@@ -500,7 +500,7 @@
             }
         };
 
-        webSocket = newHttpClient().newWebSocketBuilder()
+        webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
                 .buildAsync(server.getURI(), listener)
                 .join();