use of io.reactivex.rxjava3.subscribers in project RxJava by ReactiveX.
the class FlowableTakeUntilTest method untilPublisherOtherError.
@Test
public void untilPublisherOtherError() {
PublishProcessor<Integer> main = PublishProcessor.create();
PublishProcessor<Integer> other = PublishProcessor.create();
TestSubscriber<Integer> ts = main.takeUntil(other).test();
assertTrue("Main no subscribers?", main.hasSubscribers());
assertTrue("Other no subscribers?", other.hasSubscribers());
other.onError(new TestException());
assertFalse("Main has subscribers?", main.hasSubscribers());
assertFalse("Other has subscribers?", other.hasSubscribers());
ts.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.subscribers in project RxJava by ReactiveX.
the class ParallelJoinTest method overflowSlowpathDelayError.
@Test
public void overflowSlowpathDelayError() {
@SuppressWarnings("unchecked") final Subscriber<? super Integer>[] subs = new Subscriber[1];
TestSubscriber<Integer> ts = new TestSubscriber<Integer>(1) {
@Override
public void onNext(Integer t) {
super.onNext(t);
if (t == 1) {
subs[0].onNext(2);
subs[0].onNext(3);
}
}
};
new ParallelFlowable<Integer>() {
@Override
public void subscribe(Subscriber<? super Integer>[] subscribers) {
subs[0] = subscribers[0];
subscribers[0].onSubscribe(new BooleanSubscription());
subscribers[0].onNext(1);
}
@Override
public int parallelism() {
return 1;
}
}.sequentialDelayError(1).subscribe(ts);
ts.request(1);
ts.assertFailure(MissingBackpressureException.class, 1, 2);
}
use of io.reactivex.rxjava3.subscribers in project RxJava by ReactiveX.
the class ParallelJoinTest method overflowSlowpath.
@Test
public void overflowSlowpath() {
@SuppressWarnings("unchecked") final Subscriber<? super Integer>[] subs = new Subscriber[1];
TestSubscriber<Integer> ts = new TestSubscriber<Integer>(1) {
@Override
public void onNext(Integer t) {
super.onNext(t);
subs[0].onNext(2);
subs[0].onNext(3);
}
};
new ParallelFlowable<Integer>() {
@Override
public void subscribe(Subscriber<? super Integer>[] subscribers) {
subs[0] = subscribers[0];
subscribers[0].onSubscribe(new BooleanSubscription());
subscribers[0].onNext(1);
}
@Override
public int parallelism() {
return 1;
}
}.sequential(1).subscribe(ts);
ts.assertFailure(MissingBackpressureException.class, 1);
}
use of io.reactivex.rxjava3.subscribers in project RxJava by ReactiveX.
the class ParallelJoinTest method overflowFastpathDelayError.
@Test
public void overflowFastpathDelayError() {
new ParallelFlowable<Integer>() {
@Override
public void subscribe(Subscriber<? super Integer>[] subscribers) {
subscribers[0].onSubscribe(new BooleanSubscription());
subscribers[0].onNext(1);
subscribers[0].onNext(2);
}
@Override
public int parallelism() {
return 1;
}
}.sequentialDelayError(1).test(0).requestMore(1).assertFailure(MissingBackpressureException.class, 1);
}
use of io.reactivex.rxjava3.subscribers in project RxJava by ReactiveX.
the class ConnectableFlowable method connect.
/**
* Instructs the {@code ConnectableFlowable} to begin emitting the items from its underlying
* {@link Flowable} to its {@link Subscriber}s.
* <p>
* To disconnect from a synchronous source, use the {@link #connect(io.reactivex.rxjava3.functions.Consumer)} method.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>The behavior is determined by the implementor of this abstract class.</dd>
* </dl>
*
* @return the subscription representing the connection
* @see <a href="http://reactivex.io/documentation/operators/connect.html">ReactiveX documentation: Connect</a>
*/
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public final Disposable connect() {
ConnectConsumer cc = new ConnectConsumer();
connect(cc);
return cc.disposable;
}
Aggregations