code: @SuppressWarnings("unchecked")
    private <T extends Request> void handleResponse(T request, BiFunction sender, Connection connection, Response response, Throwable error, CompletableFuture future) {
      if (open) {
        if (error == null) {
          if (response.status() == Response.Status.OK
            || response.error() == CopycatError.Type.COMMAND_ERROR
            || response.error() == CopycatError.Type.QUERY_ERROR
            || response.error() == CopycatError.Type.APPLICATION_ERROR
            || response.error() == CopycatError.Type.UNKNOWN_SESSION_ERROR
            || response.error() == CopycatError.Type.INTERNAL_ERROR) {
            LOGGER.trace("{} - Received {}", id, response);
            future.complete(response);
          } else {
            resendRequest(response.error().createException(), request, sender, connection, future);
          }
        } else if (error instanceof ConnectException || error instanceof TimeoutException || error instanceof TransportException || error instanceof ClosedChannelException) {
          resendRequest(error, request, sender, connection, future);
        } else {
          LOGGER.debug("{} - {} failed! Reason: {}", id, request, error);
          future.completeExceptionally(error);
        }
      }
    }
docs: Handles a response from the cluster.