@Test
public void testRefreshBackendInfo() throws Exception {

    final CompletionStage<ShardBackendInfo> backendInfo = moduleShardBackendResolver.getBackendInfo(0L);
    //handle first connect
    contextProbe.expectMsgClass(ConnectClientRequest.class);
    final TestProbe staleBackendProbe = new TestProbe(system, "staleBackend");
    final ConnectClientSuccess msg = new ConnectClientSuccess(CLIENT_ID, 0L, staleBackendProbe.ref(),
            Collections.emptyList(), dataTree, 3);
    contextProbe.reply(msg);
    //get backend info
    final ShardBackendInfo staleBackendInfo = TestUtils.getWithTimeout(backendInfo.toCompletableFuture());
    //refresh
    final CompletionStage<ShardBackendInfo> refreshed =
            moduleShardBackendResolver.refreshBackendInfo(0L, staleBackendInfo);
    //stale backend info should be removed and new connect request issued to the context
    contextProbe.expectMsgClass(ConnectClientRequest.class);
    final TestProbe refreshedBackendProbe = new TestProbe(system, "refreshedBackend");
    final ConnectClientSuccess msg2 = new ConnectClientSuccess(CLIENT_ID, 1L, refreshedBackendProbe.ref(),
            Collections.emptyList(), dataTree, 3);
    contextProbe.reply(msg2);
    final ShardBackendInfo refreshedBackendInfo = TestUtils.getWithTimeout(refreshed.toCompletableFuture());
    Assert.assertEquals(staleBackendInfo.getCookie(), refreshedBackendInfo.getCookie());
    Assert.assertEquals(refreshedBackendProbe.ref(), refreshedBackendInfo.getActor());
}