@Test
public void testWithBlackHole() throws Exception {

    assumeThat(getAvailableNetworkInterface(), isAvailable());
    saveRemoteAttachment("http://" + BLACK_HOLE_ADDRESS + "/filename");
    assertThat(repository.getOnlyRemoteAttachments(), hasSize(1));
    ExecutorService executor = newSingleThreadExecutor();
    try {
        Future<Integer> future = executor.submit(new Callable<Integer>() {
            @Override
            public Integer call() throws Exception {
                return retrieveRemoteAttachments(DatabaseSettings.getConfiguredHttpClient(), dbName, downloadTimeout);
            }
        });
        try {
            Integer downloadedSuccessfully = future.get(1, TimeUnit.MINUTES);
            assertThat(downloadedSuccessfully, is(0));
        } catch (TimeoutException e) {
            fail("retriever got stuck on a black hole");
            throw e; // unreachable
        }
    } finally {
        executor.shutdown();
        executor.awaitTermination(1, TimeUnit.MINUTES);
    }
    assertThat(repository.getOnlyRemoteAttachments(), hasSize(1));
}