@Test
void shouldFailConnectionInitializedPromiseWhenHandshakeFails()
{

    ChannelPromise channelInitializedPromise = channel.newPromise();
    HandshakeCompletedListener listener = new HandshakeCompletedListener( "user-agent", authToken(), RoutingContext.EMPTY,
            channelInitializedPromise );
    ChannelPromise handshakeCompletedPromise = channel.newPromise();
    IOException cause = new IOException( "Bad handshake" );
    handshakeCompletedPromise.setFailure( cause );
    listener.operationComplete( handshakeCompletedPromise );
    Exception error = assertThrows( Exception.class, () -> await( channelInitializedPromise ) );
    assertEquals( cause, error );
}