@Test
public void testGetServicesInputStreamException()
        throws Exception
{

    final IOException testingException = new IOException("testing exception");
    ListenableFuture<ServiceDescriptors> future = createClient(
            request -> mockResponse()
                    .contentType(MediaType.JSON_UTF_8)
                    .body(new InputStream()
                    {
                        @Override
                        public int read()
                                throws IOException
                        {
                            throw testingException;
                        }
                    })
                    .build())
            .getServices("testService", "testPool");
    try {
        future.get();
        fail("Expected ExecutionException");
    }
    catch (ExecutionException e) {
        assertInstanceOf(e.getCause(), DiscoveryException.class);
        assertSame(e.getCause().getCause(), testingException);
        assertEquals(e.getCause().getMessage(), "Lookup of testService failed");
    }
}