### Question:
RxCmdShell { public synchronized Single<Integer> close() { if (RXSDebug.isDebug()) Timber.tag(TAG).v("close()"); if (session == null) return Single.just(Cmd.ExitCode.OK); else return session.flatMap(Session::close); } @SuppressWarnings("unused") private  RxCmdShell();   RxCmdShell(Builder builder, RxShell rxShell); synchronized Single<Session> open(); Single<Boolean> isAlive(); synchronized Completable cancel(); synchronized Single<Integer> close(); static Builder builder();  }### Answer:
@Test public void testClose() throws IOException { RxCmdShell shell = new RxCmdShell(builder, rxShell); RxCmdShell.Session session1 = shell.open().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().values().get(0); session1.isAlive().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertValue(true); session1.close().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertValue(0); verify(rxShellSession).close(); session1.isAlive().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().assertValue(false); RxCmdShell.Session session2 = shell.open().test().awaitDone(1, TimeUnit.SECONDS).assertNoErrors().values().get(0); assertThat(session2, is(not(session1))); }