test/jdk/java/net/httpclient/websocket/PendingTextPongClose.java
branchhttp-client-branch
changeset 56486 b664a887e277
parent 56451 9585061fdb04
child 56507 2294c51eae30
equal deleted inserted replaced
56483:ff806eb4a2a4 56486:b664a887e277
    36 import java.nio.ByteBuffer;
    36 import java.nio.ByteBuffer;
    37 import java.nio.CharBuffer;
    37 import java.nio.CharBuffer;
    38 import java.util.concurrent.CompletableFuture;
    38 import java.util.concurrent.CompletableFuture;
    39 import java.util.concurrent.TimeUnit;
    39 import java.util.concurrent.TimeUnit;
    40 import java.util.concurrent.TimeoutException;
    40 import java.util.concurrent.TimeoutException;
    41 
    41 import static java.net.http.HttpClient.Builder.NO_PROXY;
    42 import static java.net.http.HttpClient.newHttpClient;
    42 import static java.net.http.HttpClient.newBuilder;
    43 
    43 
    44 public class PendingTextPongClose extends PendingOperations {
    44 public class PendingTextPongClose extends PendingOperations {
    45 
    45 
    46     CompletableFuture<WebSocket> cfText;
    46     CompletableFuture<WebSocket> cfText;
    47     CompletableFuture<WebSocket> cfPong;
    47     CompletableFuture<WebSocket> cfPong;
    50     @Test(dataProvider = "booleans")
    50     @Test(dataProvider = "booleans")
    51     public void pendingTextPongClose(boolean last) throws Exception {
    51     public void pendingTextPongClose(boolean last) throws Exception {
    52         repeatable(() -> {
    52         repeatable(() -> {
    53             server = Support.notReadingServer();
    53             server = Support.notReadingServer();
    54             server.open();
    54             server.open();
    55             webSocket = newHttpClient().newWebSocketBuilder()
    55             webSocket = newBuilder().proxy(NO_PROXY).build().newWebSocketBuilder()
    56                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
    56                     .buildAsync(server.getURI(), new WebSocket.Listener() { })
    57                     .join();
    57                     .join();
    58             CharBuffer data = CharBuffer.allocate(65536);
    58             CharBuffer data = CharBuffer.allocate(65536);
    59             for (int i = 0; ; i++) {  // fill up the send buffer
    59             for (int i = 0; ; i++) {  // fill up the send buffer
    60                 long start = System.currentTimeMillis();
    60                 long start = System.currentTimeMillis();