@Test
public void testStreamThatEndsWithError() {

    final ReactiveDataConsumer consumer = new ReactiveDataConsumer();
    final Single<List<Notification<ByteBuffer>>> single = Observable.fromPublisher(consumer)
        .materialize()
        .toList();
    final Exception ex = new RuntimeException();
    consumer.failed(ex);
    Assert.assertSame(ex, single.blockingGet().get(0).getError());
}