[java] follow the contract of Closeable.close()
follow the contract of Closeable.close()
It should be possible to call close multiple times without exception.
@@ -245,8 +245,12 @@ public WebSocket send(Message message) {
@Override
public void close() {
LOG.fine("Closing websocket");
+ synchronized (underlyingSocket) {
+ if (!underlyingSocket.isOutputClosed()) {
underlyingSocket.sendClose(1000, "WebDriver closing socket");
}
+ }
+ }
};
}
