In the javadoc of sendClose(...) "
If this method has already been invoked or the WebSocket is closed, then subsequent invocations of this method have no effect and the returned CompletableFuture completes normally."
But currently implementation will throw internal error, as implemented in private CompletableFuture<WebSocket> enqueueClose(Close m).
This can be reproduced with a simple test here :
http://cr.openjdk.java.net/~xiaofeya/8184731/webrev.00/test/java/net/httpclient/websocket/CloseTest.java.html
If this method has already been invoked or the WebSocket is closed, then subsequent invocations of this method have no effect and the returned CompletableFuture completes normally."
But currently implementation will throw internal error, as implemented in private CompletableFuture<WebSocket> enqueueClose(Close m).
This can be reproduced with a simple test here :
http://cr.openjdk.java.net/~xiaofeya/8184731/webrev.00/test/java/net/httpclient/websocket/CloseTest.java.html