@Test
public void crossDispose() {

    PublishSubject<Integer> ps = PublishSubject.create();
    final TestObserver<Void> to1 = new TestObserver<Void>();
    final TestObserver<Void> to2 = new TestObserver<Void>() {
        @Override
        public void onComplete() {
            super.onComplete();
            to1.cancel();
        }
    };
    Completable c = ps.ignoreElements().cache();
    c.subscribe(to2);
    c.subscribe(to1);
    ps.onComplete();
    to1.assertEmpty();
    to2.assertResult();
}