@Test
  public void testSetReplicationEndpoint() throws InterruptedException, ExecutionException {
    // make sure that we do not need to set cluster key when we use customized ReplicationEndpoint
    admin
      .addReplicationPeer(ID_ONE,
        ReplicationPeerConfig.newBuilder()
          .setReplicationEndpointImpl(VerifyWALEntriesReplicationEndpoint.class.getName()).build())
      .get();

    // but we still need to check cluster key if we specify the default ReplicationEndpoint
    try {
      admin
        .addReplicationPeer(ID_TWO, ReplicationPeerConfig.newBuilder()
          .setReplicationEndpointImpl(HBaseInterClusterReplicationEndpoint.class.getName()).build())
        .get();
      fail();
    } catch (ExecutionException e) {
      assertThat(e.getCause(), instanceOf(DoNotRetryIOException.class));
    }
  }
Class to test asynchronous replication admin operations.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncReplicationAdminApi.java