@Test
public void testExceptionDuringConnectionFactoryCreation() {

    new TestKit(actorSystem) {{
        final Props props =
                RabbitMQClientActor.propsForTests(connection, getRef(),
                        getRef(), (con, exHandler) -> { throw CUSTOM_EXCEPTION; })
                        .withDispatcher(CallingThreadDispatcher.Id());
        final ActorRef connectionActor = actorSystem.actorOf(props);
        connectionActor.tell(OpenConnection.of(CONNECTION_ID, DittoHeaders.empty()), getRef());
        expectMsgClass(Status.Failure.class);
    }};
}