private PeerId findTargetPeer(final PeerId self, final String groupId, final Configuration conf,
                                  final LeaderCounter leaderCounter) {
        for (final PeerId peerId : getAlivePeers(groupId, conf)) {
            if (peerId.equals(self)) {
                continue;
            }
            if (leaderCounter.get(peerId) >= leaderCounter.getExpectedAverage()) {
                continue;
            }
            return peerId;
        }
        return PeerId.emptyPeer();
    }
Cli service implementation.

@author boyan (boyan@alibaba-inc.com)
@author jiachun.fjc
jraft-core/src/main/java/com/alipay/sofa/jraft/core/CliServiceImpl.java