@Test
public void testMultipleUnsuccessfulRequests() throws Exception {

    // Unique URL is needed for each test as once the URL is used it will be cached
    URL unreachableURL = getUniqueURL(PATH_TO_MISSING_RESOURCE);
    // First request throws exception, because a get request is sent
    try {
        testClient.get(unreachableURL);
    } catch (IOException e) {
        assertThat(e, instanceOf(IOException.class));
        assertThat(e.getMessage(), equalTo("Unable to get " + unreachableURL.toString()));
        assertThat(e.getCause(), instanceOf(FileNotFoundException.class));
    }
    // Next requests do not throw exception
    assertNull(testClient.get(unreachableURL));
    assertNull(testClient.get(unreachableURL));
    verify(server.getHandler(), times(1)).handle(any(), any(), any(), any());
}