# HG changeset patch # User chegar # Date 1524750156 -3600 # Node ID b664a887e277f93546dcd6f423eb460dcc8020fd # Parent ff806eb4a2a4e06942b0b4c942c7fe3a4c725d18 http-client-branch: set NO_PROXY in several WebSocket tests diff -r ff806eb4a2a4 -r b664a887e277 test/jdk/java/net/httpclient/websocket/PendingBinaryPingClose.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); diff -r ff806eb4a2a4 -r b664a887e277 test/jdk/java/net/httpclient/websocket/PendingBinaryPongClose.java --- 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); diff -r ff806eb4a2a4 -r b664a887e277 test/jdk/java/net/httpclient/websocket/PendingPingBinaryClose.java --- 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); diff -r ff806eb4a2a4 -r b664a887e277 test/jdk/java/net/httpclient/websocket/PendingPingTextClose.java --- 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); diff -r ff806eb4a2a4 -r b664a887e277 test/jdk/java/net/httpclient/websocket/PendingPongBinaryClose.java --- 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); diff -r ff806eb4a2a4 -r b664a887e277 test/jdk/java/net/httpclient/websocket/PendingPongTextClose.java --- 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); diff -r ff806eb4a2a4 -r b664a887e277 test/jdk/java/net/httpclient/websocket/PendingTextPingClose.java --- 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); diff -r ff806eb4a2a4 -r b664a887e277 test/jdk/java/net/httpclient/websocket/PendingTextPongClose.java --- 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); diff -r ff806eb4a2a4 -r b664a887e277 test/jdk/java/net/httpclient/websocket/SendTest.java --- 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(); diff -r ff806eb4a2a4 -r b664a887e277 test/jdk/java/net/httpclient/websocket/WSHandshakeExceptionTest.java --- 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(); diff -r ff806eb4a2a4 -r b664a887e277 test/jdk/java/net/httpclient/websocket/WebSocketExtendedTest.java --- 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(); diff -r ff806eb4a2a4 -r b664a887e277 test/jdk/java/net/httpclient/websocket/WebSocketTest.java --- 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();