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