@Override
  public ScanResponse scan(RpcController controller, ScanRequest request) throws ServiceException {
    ScanResponse.Builder builder = ScanResponse.newBuilder();
    try {
      if (request.hasScan()) {
        byte[] regionName = request.getRegion().getValue().toByteArray();
        builder.setScannerId(openScanner(regionName, null));
        builder.setMoreResults(true);
      } else {
        long scannerId = request.getScannerId();
        Result result = next(scannerId);
        if (result != null) {
          builder.addCellsPerResult(result.size());
          List<ExtendedCellScannable> results = new ArrayList<>(1);
          results.add(result);
          ((HBaseRpcController) controller)
            .setCellScanner(PrivateCellUtil.createExtendedCellScanner(results));
          builder.setMoreResults(true);
        } else {
          builder.setMoreResults(false);
          close(scannerId);
        }
      }
    } catch (IOException ie) {
      throw new ServiceException(ie);
    }
    return builder.build();
  }
Use this method to set what a scanner will reply as we next through
hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java