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