@Override
    public void preScannerOpen(final ObserverContext<? extends RegionCoprocessorEnvironment> e,
      final Scan scan) throws IOException {
      int replicaId = e.getEnvironment().getRegion().getRegionInfo().getReplicaId();
      // Fail for the primary replica and replica 1
      if (e.getEnvironment().getRegion().getRegionInfo().getReplicaId() <= 1) {
        LOG.info("Throw Region Server Stopped Exceptoin for replica id " + replicaId);
        throw new RegionServerStoppedException(
          "Server " + e.getEnvironment().getServerName() + " not running");
      } else {
        LOG.info("We're replica region " + replicaId);
      }
    }
This copro is used to simulate region server down exception for Get and Scan
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicaWithCluster.java