@Test
public void testJsonReadException()
        throws IOException
{

    InputStream inputStream = mock(InputStream.class);
    IOException expectedException = new IOException("test exception");
    when(inputStream.read()).thenThrow(expectedException);
    when(inputStream.read(any(byte[].class))).thenThrow(expectedException);
    when(inputStream.read(any(byte[].class), anyInt(), anyInt())).thenThrow(expectedException);
    try {
        handler.handle(null, mockResponse()
                .contentType(MEDIA_TYPE_SMILE)
                .body(inputStream)
                .build());
        fail("expected exception");
    }
    catch (RuntimeException e) {
        assertEquals(e.getMessage(), "Error reading SMILE response from server");
        assertSame(e.getCause(), expectedException);
    }
}