/** Handles closing the session. */ private void onClose() { if (isOpen()) { LOGGER.debug("Closed session: {}", id); this.id = 0; this.state = State.CLOSED; if (connection != null) connection.close(); client.close(); context.close(); closeListeners.forEach(l -> l.accept(this)); } }
@Override public CompletableFuture<Void> close() { return remote.close().thenRun(local::close); }