private ReplicationPeerImpl createPeer(String peerId) throws ReplicationException {
    ReplicationPeerConfig peerConfig = peerStorage.getPeerConfig(peerId);
    boolean enabled = peerStorage.isPeerEnabled(peerId);
    SyncReplicationState syncReplicationState = peerStorage.getPeerSyncReplicationState(peerId);
    SyncReplicationState newSyncReplicationState =
      peerStorage.getPeerNewSyncReplicationState(peerId);
    Configuration peerClusterConf;
    try {
      peerClusterConf = ReplicationPeerConfigUtil.getPeerClusterConfiguration(conf, peerConfig);
    } catch (IOException e) {
      throw new ReplicationException(
        "failed to apply cluster key to configuration for peer config " + peerConfig, e);
    }
    return new ReplicationPeerImpl(peerClusterConf, peerId, peerConfig, enabled,
      syncReplicationState, newSyncReplicationState);
  }
Helper method to connect to a peer
@param peerId peer's identifier
@return object representing the peer
hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeers.java