### Question:
RxShell { public synchronized Single<Integer> close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Single.just(0); else return session.flatMap(Session::close); } RxShell(RxProcess rxProcess); synchronized Single<Session> open(); synchronized Single<Boolean> isAlive(); synchronized Completable cancel(); synchronized Single<Integer> close();  }### Answer:
@Test public void testClose() throws IOException { RxShell rxShell = new RxShell(rxProcess); RxShell.Session session = rxShell.open().test().awaitDone(10, TimeUnit.SECONDS).assertNoErrors().values().get(0); session.close().test().awaitDone(10, TimeUnit.SECONDS).assertNoErrors().assertValue(0); await().atMost(2, TimeUnit.SECONDS).until(() -> cmdStream.getData().toString().contains("exit" + LineReader.getLineSeparator())); await().atMost(1, TimeUnit.SECONDS).until(() -> cmdStream.isOpen(), is(false)); session.close().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertValue(0); }