### Question:
RxProcess { public synchronized Completable close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Completable.complete(); else return session.flatMapCompletable(s -> s.destroy().andThen(s.waitFor().ignoreElement())); } RxProcess(ProcessFactory processFactory, ProcessKiller processKiller, String... commands); synchronized Single<Session> open(); synchronized Single<Boolean> isAlive(); synchronized Completable close();  }### Answer:
@Test public void testClose() { RxProcess rxProcess = new RxProcess(processFactory, processKiller, "sh"); rxProcess.close().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertComplete(); rxProcess.open().test().awaitCount(1).assertNoErrors(); assertThat(mockProcesses.get(0).isAlive(), is(true)); rxProcess.close().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertComplete(); verify(mockProcesses.get(0)).destroy(); assertThat(mockProcesses.get(0).isAlive(), is(false)); verify(processKiller).kill(mockProcesses.get(0)); }