@Test
public void testReconnectAndVerifyConnectionStatus() {

    new TestKit(actorSystem) {{
        final TestProbe aggregator = new TestProbe(actorSystem);
        final Props props =
                AmqpClientActor.propsForTests(connection,
                        getRef(), getRef(), (connection1, exceptionListener) -> mockConnection);
        final ActorRef amqpClientActor = actorSystem.actorOf(props);
        watch(amqpClientActor);
        amqpClientActor.tell(OpenConnection.of(CONNECTION_ID, DittoHeaders.empty()), getRef());
        expectMsg(CONNECTED_SUCCESS);
        amqpClientActor.tell(RetrieveConnectionStatus.of(CONNECTION_ID, DittoHeaders.empty()), aggregator.ref());
        aggregator.expectMsgClass(ResourceStatus.class);
        final JmsConnectionListener connectionListener = checkNotNull(listenerArgumentCaptor.getValue());
        connectionListener.onConnectionInterrupted(DUMMY);
        verifyConnectionStatus(amqpClientActor, aggregator, ConnectivityStatus.FAILED);
        connectionListener.onConnectionRestored(DUMMY);
        verifyConnectionStatus(amqpClientActor, aggregator, ConnectivityStatus.OPEN);
        amqpClientActor.tell(CloseConnection.of(CONNECTION_ID, DittoHeaders.empty()), getRef());
        expectMsg(DISCONNECTED_SUCCESS);
    }};
}