@SuppressWarnings("unchecked")
@Test
public void test() {

    final InputChannel<Integer> mockInputChannel = mock(InputChannel.class);
    when(mockInputChannel.recv()).thenReturn(
            Futures.immediateFuture(1),
            Futures.immediateFuture(2),
            Futures.immediateFailedFuture(PowerMockito.mock(EndOfFileException.class)));
    assertEquals(ImmutableList.of(1, 2), RxTestCase.first(
            RxInputChannel.wrap(mockInputChannel).autoConnect().toList()));
}