@Test
public void testTimeoutSelectorSubsequentObservableThrows() {

    PublishSubject<Integer> source = PublishSubject.create();
    final PublishSubject<Integer> timeout = PublishSubject.create();
    Func1<Integer, Observable<Integer>> timeoutFunc = new Func1<Integer, Observable<Integer>>() {
        @Override
        public Observable<Integer> call(Integer t1) {
            return Observable.<Integer> error(new OperationReduceTest.CustomException());
        }
    };
    Func0<Observable<Integer>> firstTimeoutFunc = new Func0<Observable<Integer>>() {
        @Override
        public Observable<Integer> call() {
            return timeout;
        }
    };
    Observable<Integer> other = Observable.from(Arrays.asList(100));
    @SuppressWarnings("unchecked")
    Observer<Object> o = mock(Observer.class);
    InOrder inOrder = inOrder(o);
    source.timeout(firstTimeoutFunc, timeoutFunc, other).subscribe(o);
    source.onNext(1);
    inOrder.verify(o).onNext(1);
    inOrder.verify(o).onError(any(OperationReduceTest.CustomException.class));
    verify(o, never()).onCompleted();
}