@Test(expected = RuntimeException.class)
public void shouldCloseInputStreamIfExceptionIsThrownAndInputStreamIsStillOpen() throws Exception
{

    mockery.checking(new Expectations()
    {
        {
            ignoring(connectionObserver).connectionClosed();
            allowing(byteStreamMessageParser).parse(with(any(ByteBuffer.class)));
            //when
            one(readableByteChannel).read(with(any(ByteBuffer.class)));
            will(throwException(new RuntimeException("boom!")));
            //then
            one(readableByteChannel).isOpen();
            will(returnValue(true));
            one(readableByteChannel).close();
        }
    });
    //when
    inputStreamReader.blockingStart(readableByteChannel);
}