@Test
public void shouldNotifyTransportObserverWhenIOExceptionIsThrown() throws Exception
{

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