@Test
public void disposeTwice() {

    CompletableSubject.create()
    .subscribe(new CompletableObserver() {
        @Override
        public void onSubscribe(Disposable d) {
            assertFalse(d.isDisposed());
            d.dispose();
            d.dispose();
            assertTrue(d.isDisposed());
        }
        @Override
        public void onError(Throwable e) {
        }
        @Override
        public void onComplete() {
        }
    });
}