@Test
void shouldFailPromiseWhenChannelConnectionFails()
{

    ChannelPromise handshakeCompletedPromise = channel.newPromise();
    ChannelConnectedListener listener = newListener( handshakeCompletedPromise );
    ChannelPromise channelConnectedPromise = channel.newPromise();
    IOException cause = new IOException( "Unable to connect!" );
    channelConnectedPromise.setFailure( cause );
    listener.operationComplete( channelConnectedPromise );
    ServiceUnavailableException error = assertThrows( ServiceUnavailableException.class, () -> await( handshakeCompletedPromise ) );
    assertEquals( cause, error.getCause() );
}