### Question:
StoreReader { void startBackgroundAddressRefresh(RxDocumentServiceRequest request) { this.addressSelector.resolveAllUriAsync(request, true, true) .observeOn(Schedulers.io()) .subscribe( r -> { }, e -> logger.warn( "Background refresh of the addresses failed with {}", e.getMessage(), e) ); } StoreReader(
            TransportClient transportClient,
            AddressSelector addressSelector,
            ISessionContainer sessionContainer); Single<List<StoreResult>> readMultipleReplicaAsync(
            RxDocumentServiceRequest entity,
            boolean includePrimary,
            int replicaCountToRead,
            boolean requiresValidLsn,
            boolean useSessionToken,
            ReadMode readMode); Single<List<StoreResult>> readMultipleReplicaAsync(
            RxDocumentServiceRequest entity,
            boolean includePrimary,
            int replicaCountToRead,
            boolean requiresValidLsn,
            boolean useSessionToken,
            ReadMode readMode,
            boolean checkMinLSN,
            boolean forceReadAll); Single<StoreResult> readPrimaryAsync(
            RxDocumentServiceRequest entity,
            boolean requiresValidLsn,
            boolean useSessionToken);  }### Answer:
@Test(groups = "unit") public void startBackgroundAddressRefresh() throws Exception { TransportClient transportClient = Mockito.mock(TransportClient.class); AddressSelector addressSelector = Mockito.mock(AddressSelector.class); ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); StoreReader storeReader = new StoreReader(transportClient, addressSelector, sessionContainer); CyclicBarrier b = new CyclicBarrier(2); PublishSubject<List<Uri>> subject = PublishSubject.create(); CountDownLatch c = new CountDownLatch(1); List<Uri> uris = ImmutableList.of(Uri.create("https: Uri.create("https: Mockito.doAnswer(new Answer() { @Override public Single<List<Uri>> answer(InvocationOnMock invocationOnMock) throws Throwable { return subject.toSingle().doOnSuccess(x -> c.countDown()).doAfterTerminate(() -> { new Thread() { @Override public void run() { try { b.await(); } catch (Exception e) { } } }.start(); }); } }).when(addressSelector).resolveAllUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.eq(true), Mockito.eq(true)); RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); storeReader.startBackgroundAddressRefresh(request); subject.onNext(uris); subject.onCompleted(); TimeUnit.MILLISECONDS.sleep(100); AssertionsForClassTypes.assertThat(c.getCount()).isEqualTo(0); AssertionsForClassTypes.assertThat(b.getNumberWaiting()).isEqualTo(1); b.await(1000, TimeUnit.MILLISECONDS); }