@Test
public void testMulticast() {

    Subject<String, String> source = PublishSubject.create();
    ConnectableObservable<String> multicasted = new OperatorMulticast<String, String>(source, new PublishSubjectFactory());
    @SuppressWarnings("unchecked")
    Observer<String> observer = mock(Observer.class);
    multicasted.subscribe(observer);
    source.onNext("one");
    source.onNext("two");
    multicasted.connect();
    source.onNext("three");
    source.onNext("four");
    source.onCompleted();
    verify(observer, never()).onNext("one");
    verify(observer, never()).onNext("two");
    verify(observer, times(1)).onNext("three");
    verify(observer, times(1)).onNext("four");
    verify(observer, times(1)).onCompleted();
}