src/main/java/org/java_websocket/server/WebSocketServer.java
protected boolean removeConnection( WebSocket ws ) {
		boolean removed = false;
		synchronized ( connections ) {
			if (this.connections.contains( ws )) {
				removed = this.connections.remove( ws );
			} else {
				//Don't throw an assert error if the ws is not in the list. e.g. when the other endpoint did not send any handshake. see #512
				log.trace("Removing connection which is not in the connections collection! Possible no handshake recieved! {}", ws);
			}
		}
		if( isclosed.get() && connections.isEmpty() ) {
			selectorthread.interrupt();
		}
		return removed;
	}
protected boolean removeConnection( WebSocket ws ) {
		boolean removed = false;
		synchronized ( connections ) {
			if (this.connections.contains( ws )) {
				removed = this.connections.remove( ws );
			} else {
				//Don't throw an assert error if the ws is not in the list. e.g. when the other endpoint did not send any handshake. see #512
				log.trace("Removing connection which is not in the connections collection! Possible no handshake recieved! {}", ws);
			}
		}
		if( isclosed.get() && connections.isEmpty() ) {
			selectorthread.interrupt();
		}
		return removed;
	}
This method performs remove operations on the connection and therefore also gives control over whether the operation shall be synchronized
<p>
{@link #WebSocketServer(InetSocketAddress, int, List, Collection)} allows to specify a collection which will be used to store current connections in.<br>
Depending on the type on the connection, modifications of that collection may have to be synchronized.
@param ws The Websocket connection which should be removed
@return Removing connection successful