@Test
public void testCloseFailed() throws IOException {

  EventLogHttpTransferListener listener = new EventLogHttpTransferListener();
  ReadableByteChannel in = mock(ReadableByteChannel.class);
  doThrow(new IOException("test")).when(in).close();
  ReadableByteChannel oin = new ObservableRedableByteChannel(in, listener);
  try {
    oin.close();
    fail("expected exception not thrown");
  } catch (IOException e) {
    assertEquals("test", e.getMessage());
  }
  assertEquals(of(Closed.INSTANCE), listener.getEventLog());
}