private Map<byte[], Long> sum(final Table table, final byte[] family, final byte[] qualifier,
    final byte[] start, final byte[] end) throws ServiceException, Throwable {
    return table.coprocessorService(ColumnAggregationProtos.ColumnAggregationService.class, start,
      end, new Batch.Call<ColumnAggregationProtos.ColumnAggregationService, Long>() {
        @Override
        public Long call(ColumnAggregationProtos.ColumnAggregationService instance)
          throws IOException {
          CoprocessorRpcUtils.BlockingRpcCallback<ColumnAggregationProtos.SumResponse> rpcCallback =
            new CoprocessorRpcUtils.BlockingRpcCallback<>();
          ColumnAggregationProtos.SumRequest.Builder builder =
            ColumnAggregationProtos.SumRequest.newBuilder();
          builder.setFamily(UnsafeByteOperations.unsafeWrap(family));
          if (qualifier != null && qualifier.length > 0) {
            builder.setQualifier(UnsafeByteOperations.unsafeWrap(qualifier));
          }
          instance.sum(null, builder.build(), rpcCallback);
          return rpcCallback.get().getSum();
        }
      });
  }
TestEndpoint: test cases to verify coprocessor Endpoint
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java