test/jdk/java/net/httpclient/websocket/PendingBinaryPongClose.java
changeset 49944 4690a2871b44
parent 49765 ee6f7a61f3a5
child 56507 2294c51eae30
equal deleted inserted replaced
49943:8e1ed2a15845 49944:4690a2871b44
    35 import java.net.http.WebSocket;
    35 import java.net.http.WebSocket;
    36 import java.nio.ByteBuffer;
    36 import java.nio.ByteBuffer;
    37 import java.util.concurrent.CompletableFuture;
    37 import java.util.concurrent.CompletableFuture;
    38 import java.util.concurrent.TimeUnit;
    38 import java.util.concurrent.TimeUnit;
    39 import java.util.concurrent.TimeoutException;
    39 import java.util.concurrent.TimeoutException;
    40 
    40 import static java.net.http.HttpClient.Builder.NO_PROXY;
    41 import static java.net.http.HttpClient.newHttpClient;
    41 import static java.net.http.HttpClient.newBuilder;
    42 
    42 
    43 public class PendingBinaryPongClose extends PendingOperations {
    43 public class PendingBinaryPongClose extends PendingOperations {
    44 
    44 
    45     CompletableFuture<WebSocket> cfBinary;
    45     CompletableFuture<WebSocket> cfBinary;
    46     CompletableFuture<WebSocket> cfPong;
    46     CompletableFuture<WebSocket> cfPong;
    49     @Test(dataProvider = "booleans")
    49     @Test(dataProvider = "booleans")
    50     public void pendingBinaryPongClose(boolean last) throws Exception {
    50     public void pendingBinaryPongClose(boolean last) throws Exception {
    51         repeatable(() -> {
    51         repeatable(() -> {
    52             server = Support.notReadingServer();
    52             server = Support.notReadingServer();
    53             server.open();
    53             server.open();
    54             webSocket = newHttpClient().newWebSocketBuilder()
    54             webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
    55                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
    55                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
    56                     .join();
    56                     .join();
    57             ByteBuffer data = ByteBuffer.allocate(65536);
    57             ByteBuffer data = ByteBuffer.allocate(65536);
    58             for (int i = 0; ; i++) {  // fill up the send buffer
    58             for (int i = 0; ; i++) {  // fill up the send buffer
    59                 long start = System.currentTimeMillis();
    59                 long start = System.currentTimeMillis();