public void connected()

in src/main/java/org/apache/tinkerpop/gremlin/driver/SigV4WebSocketChannelizer.java [193:219]


    public void connected() {
        try {
            // Block until the handshake is complete either successfully or with an error. The handshake future
            // will complete with a timeout exception after some time so it is guaranteed that this future will
            // complete. The timeout for the handshake is configured by cluster.getConnectionSetupTimeout().
            //
            // If future completed with an exception more than likely, SSL is enabled on the server, but the client
            // forgot to enable it or perhaps the server is not configured for websockets.
            handler.handshakeFuture().sync();
        } catch (Exception ex) {
            final String errMsg;
            if (ex instanceof TimeoutException) {
                // Note that we are not using catch(TimeoutException ex) because the compiler throws an error for
                // catching a checked exception which is not thrown from the code inside try. However, the compiler
                // check is incorrect since Netty bypasses the compiler check and sync() is able to rethrow underlying
                // exception even if it is a check exception.
                // More information about how Netty bypasses compiler check at https://github.com/netty/netty/blob/d371b1bbaa3b98f957f6b025673098ad3adb5131/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L418
                errMsg = "Timed out while waiting to complete the connection setup. Consider increasing the " +
                        "WebSocket handshake timeout duration.";
            } else {
                errMsg = "Could not complete connection setup to the server. Ensure that SSL is correctly " +
                        "configured at both the client and the server. Ensure that client WebSocket handshake " +
                        "protocol matches the server. Ensure that the server is still reachable.";
            }
            throw new ConnectionException(connection.getUri(), errMsg, ex);
        }
    }