private CompletableFuture<Message> rpcCall(MethodDescriptor method, Message request,
    Message responsePrototype, HBaseRpcController controller, ClientService.Interface stub) {
    CompletableFuture<Message> future = new CompletableFuture<>();
    CoprocessorServiceRequest csr =
      CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request);
    stub.execRegionServerService(controller, csr,
      new org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback<
        CoprocessorServiceResponse>() {

        @Override
        public void run(CoprocessorServiceResponse resp) {
          if (controller.failed()) {
            future.completeExceptionally(controller.getFailed());
          } else {
            try {
              future.complete(CoprocessorRpcUtils.getResponse(resp, responsePrototype));
            } catch (IOException e) {
              future.completeExceptionally(e);
            }
          }
        }
      });
    return future;
  }
The implementation of a region server based coprocessor rpc channel.
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCoprocessorRpcChannelImpl.java