private void doPutTest(byte[] row) throws IOException, InterruptedException {
    Put put = new Put(row);
    put.addColumn(famName, row, row);

    if (htable1 == null) {
      htable1 = UTIL1.getConnection().getTable(tableName);
    }

    htable1.put(put);

    Get get = new Get(row);
    for (int i = 0; i < NB_RETRIES; i++) {
      if (i == NB_RETRIES - 1) {
        fail("Waited too much time for put replication");
      }
      Result res = htable2.get(get);
      if (res.isEmpty()) {
        LOG.info("Row not available");
        Thread.sleep(SLEEP_TIME);
      } else {
        assertArrayEquals(res.value(), row);
        break;
      }
    }
  }
Test handling of changes to the number of a peer's regionservers.
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java