@Test
  public void testCoprocessorServiceNullResponse() throws Throwable {
    Table table = util.getConnection().getTable(TEST_TABLE);
    List<HRegionLocation> regions;
    try (RegionLocator rl = util.getConnection().getRegionLocator(TEST_TABLE)) {
      regions = rl.getAllRegionLocations();
    }

    final TestProtos.EchoRequestProto request =
      TestProtos.EchoRequestProto.newBuilder().setMessage("hello").build();
    try {
      // scan: for all regions
      final RpcController controller = new ServerRpcController();
      // test that null results are supported
      Map<byte[],
        String> results = table.coprocessorService(TestRpcServiceProtos.TestProtobufRpcProto.class,
          ROWS[0], ROWS[ROWS.length - 1],
          new Batch.Call<TestRpcServiceProtos.TestProtobufRpcProto, String>() {
            @Override
            public String call(TestRpcServiceProtos.TestProtobufRpcProto instance)
              throws IOException {
              CoprocessorRpcUtils.BlockingRpcCallback<TestProtos.EchoResponseProto> callback =
                new CoprocessorRpcUtils.BlockingRpcCallback<>();
              instance.echo(controller, request, callback);
              TestProtos.EchoResponseProto response = callback.get();
              LOG.debug("Batch.Call got result " + response);
              return null;
            }
          });
      for (Map.Entry<byte[], String> e : results.entrySet()) {
        LOG.info("Got value " + e.getValue() + " for region " + Bytes.toStringBinary(e.getKey()));
      }
      assertEquals(3, results.size());
      for (HRegionLocation region : regions) {
        RegionInfo info = region.getRegion();
        LOG.info("Region info is " + info.getRegionNameAsString());
        assertTrue(results.containsKey(info.getRegionName()));
        assertNull(results.get(info.getRegionName()));
      }
    } finally {
      table.close();
    }
  }
TestEndpoint: test cases to verify coprocessor Endpoint
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java