HandlerHolder holder = handlers.get(request.getClass()); if (holder == null) { connection.handleResponseError(requestId, new TransportException("no handler registered")); return; handler.handle(request).whenComplete((response, error) -> { if (!open || !connection.open) { connection.handleResponseError(requestId, new IllegalStateException("connection closed")); } else if (error == null) { connection.handleResponseOk(requestId, response); } else { connection.handleResponseError(requestId, error); connection.handleResponseError(requestId, new IllegalStateException("connection closed")); connection.handleResponseError(requestId, new IllegalStateException("connection closed"));