### Question:
RxShell { public synchronized Completable cancel() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("cancel()"); if (session == null) return Completable.complete(); else return session.flatMapCompletable(Session::cancel); } RxShell(RxProcess rxProcess); synchronized Single<Session> open(); synchronized Single<Boolean> isAlive(); synchronized Completable cancel(); synchronized Single<Integer> close();  }### Answer:
@Test public void testCancel() { RxShell rxShell = new RxShell(rxProcess); RxShell.Session session = rxShell.open().test().awaitCount(1).assertNoErrors().values().get(0); session.isAlive().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertValue(true); session.cancel().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertComplete(); session.isAlive().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertValue(false); session.cancel().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertComplete(); verify(rxProcessSession).destroy(); }