if (currentState == null) {
future.completeExceptionally(new CopycatException("Invalid copycat state"));
return future;
}
currentState.submit(new SubmitRequest(nextCorrelationId(), operation, Arrays.asList(args))).whenComplete((response, error) -> {
if (error != null) {
future.completeExceptionally(error);
} else {
if (response.status().equals(Response.Status.OK)) {
future.complete((R) response.result());