@Test
public void testTakeWhileDoesntLeakErrors() {

    Observable<String> source = Observable.create(new Observable.OnSubscribeFunc<String>() {
        @Override
        public Subscription onSubscribe(Observer<? super String> observer) {
            observer.onNext("one");
            observer.onError(new Throwable("test failed"));
            return Subscriptions.empty();
        }
    });
    Observable.create(takeWhile(source, new Func1<String, Boolean>() {
        @Override
        public Boolean call(String s) {
            return false;
        }
    })).toBlockingObservable().lastOrDefault("");
}