@Test
public void testUnsubscribeSource() {

    Action0 unsubscribe = mock(Action0.class);
    Observable<Integer> o = Observable.just(1).doOnUnsubscribe(unsubscribe).cache();
    o.subscribe();
    o.subscribe();
    o.subscribe();
    verify(unsubscribe, times(1)).call();
}