private static boolean hasCauseOfType(Throwable throwable, Class<? extends Throwable> cause) {
        if (cause.isAssignableFrom(throwable.getClass())) {
            return true;
        }
        if (throwable.getCause() != null) {
            return hasCauseOfType(throwable.getCause(), cause);
        }
        return false;
    }
Called when SSL Handshake has been completed.

If successful, attempts authentication via SASL, or dialback dependent on configuration and certificate validity.
If not successful, either attempts dialback on a plain un-encrypted connection, or throws an exception dependent
on configuration.

@param ctx ChannelHandlerContext for the Netty channel
@param evt Event that has been triggered - this implementation specifically identifies SslHandshakeCompletionEvent
@throws Exception
xmppserver/src/main/java/org/jivesoftware/openfire/nio/NettyOutboundConnectionHandler.java