src/java.net.http/share/classes/jdk/internal/net/http/websocket/WebSocketImpl.java
branchhttp-client-branch
changeset 56269 234813fd33bc
parent 56263 4933a477d628
child 56291 c8c4c707ff3a
equal deleted inserted replaced
56268:481d8c9acc7f 56269:234813fd33bc
   209                                                   String reason) {
   209                                                   String reason) {
   210         Objects.requireNonNull(reason);
   210         Objects.requireNonNull(reason);
   211         if (!isLegalToSendFromClient(statusCode)) {
   211         if (!isLegalToSendFromClient(statusCode)) {
   212             return failedFuture(new IllegalArgumentException("statusCode"));
   212             return failedFuture(new IllegalArgumentException("statusCode"));
   213         }
   213         }
       
   214         // check outputClosed
   214         CompletableFuture<WebSocket> cf = sendClose0(statusCode, reason);
   215         CompletableFuture<WebSocket> cf = sendClose0(statusCode, reason);
   215         return replaceNull(cf);
   216         return replaceNull(cf);
   216     }
   217     }
   217 
   218 
   218     /*
   219     /*
   430             ByteBuffer copy = ByteBuffer.allocate(binaryData.remaining())
   431             ByteBuffer copy = ByteBuffer.allocate(binaryData.remaining())
   431                     .put(binaryData)
   432                     .put(binaryData)
   432                     .flip();
   433                     .flip();
   433             // Non-exclusive send;
   434             // Non-exclusive send;
   434             BiConsumer<WebSocketImpl, Throwable> reporter = (r, e) -> {
   435             BiConsumer<WebSocketImpl, Throwable> reporter = (r, e) -> {
   435                 if (e != null) {
   436                 if (e != null) { // Better error handing. What if already closed?
   436                     signalError(Utils.getCompletionCause(e));
   437                     signalError(Utils.getCompletionCause(e));
   437                 }
   438                 }
   438             };
   439             };
   439             transport.sendPong(copy, WebSocketImpl.this, reporter);
   440             transport.sendPong(copy, WebSocketImpl.this, reporter);
   440             listener.onPing(WebSocketImpl.this, slice);
   441             listener.onPing(WebSocketImpl.this, slice);