@Test
  public void testChangingNumberOfPeerRegionServers() throws IOException, InterruptedException {
    LOG.info("testSimplePutDelete");
    SingleProcessHBaseCluster peerCluster = UTIL2.getMiniHBaseCluster();
    // This test wants two RS's up. We only run one generally so add one.
    peerCluster.startRegionServer();
    Waiter.waitFor(peerCluster.getConfiguration(), 30000, new Waiter.Predicate<Exception>() {
      @Override
      public boolean evaluate() throws Exception {
        return peerCluster.getLiveRegionServerThreads().size() > 1;
      }
    });
    int numRS = peerCluster.getRegionServerThreads().size();

    doPutTest(Bytes.toBytes(1));

    int rsToStop = peerCluster.getServerWithMeta() == 0 ? 1 : 0;
    peerCluster.stopRegionServer(rsToStop);
    peerCluster.waitOnRegionServer(rsToStop);

    // Sanity check
    assertEquals(numRS - 1, peerCluster.getRegionServerThreads().size());

    doPutTest(Bytes.toBytes(2));

    peerCluster.startRegionServer();

    // Sanity check
    assertEquals(numRS, peerCluster.getRegionServerThreads().size());

    doPutTest(Bytes.toBytes(3));
  }
Test handling of changes to the number of a peer's regionservers.
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java