@Test(expected = TransportClosedException.class)
public void shouldNotifyTransportObserverWhenAnIOExceptionIsThrownAndCloseTheTransportWhileWritingACollection() throws Exception
{

    mockery.checking(new Expectations()
    {
        {
            //when
            one(writableByteChannel).write(with(any(ByteBuffer.class)));
            will(throwException(new IOException("Broken pipe")));
            //then
            one(connectionObserver).connectionClosed();
            one(writableByteChannel).close();
        }
    });
    handler.send(Arrays.asList(new FixMessageBuilder().build()));
}