@Test
public void shouldCloseStreamIfExceptionOccurs() throws Exception {

    interceptors.offer(new ExceptionThrowingInterceptor());
    final InterceptorContext interceptorContext_1 = mock(InterceptorContext.class);
    final InterceptorContext interceptorContext_2 = mock(InterceptorContext.class);
    final StreamCloseSpy streamSpy = new StreamCloseSpy();
    final Stream<InterceptorContext> interceptorContexts = Stream.of(
            interceptorContext_1,
            interceptorContext_2)
            .onClose(streamSpy);
    try {
        interceptorChain.processNext(interceptorContexts);
    } catch (TestException e) {
    }
    assertThat(streamSpy.streamClosed(), is(true));
}