@Test
public void testTakeUntilWithPublishedStream() {

    Observable<Integer> xs = Observable.range(0, Flowable.bufferSize() * 2);
    TestObserver<Integer> to = new TestObserver<Integer>();
    ConnectableObservable<Integer> xsp = xs.publish();
    xsp.takeUntil(xsp.skipWhile(new Predicate<Integer>() {
        @Override
        public boolean test(Integer i) {
            return i <= 3;
        }
    })).subscribe(to);
    xsp.connect();
    System.out.println(to.values());
}