@Test
public void testSubscribeAfterDisconnectThenConnect() {

    ConnectableObservable<Integer> source = Observable.just(1).publish();
    TestObserver<Integer> to1 = new TestObserver<Integer>();
    source.subscribe(to1);
    Disposable s = source.connect();
    to1.assertValue(1);
    to1.assertNoErrors();
    to1.assertTerminated();
    TestObserver<Integer> to2 = new TestObserver<Integer>();
    source.subscribe(to2);
    Disposable s2 = source.connect();
    to2.assertValue(1);
    to2.assertNoErrors();
    to2.assertTerminated();
    System.out.println(s);
    System.out.println(s2);
}