boolean peerChange(JRaftMaintainService maintainService, Set<String> newPeers) {
        // This is only dealing with node deletion, the Raft protocol, where the node adds itself to the cluster when it starts up
        Set<String> oldPeers = new HashSet<>(this.raftConfig.getMembers());
        this.raftConfig.setMembers(localPeerId.toString(), newPeers);
        oldPeers.removeAll(newPeers);
        if (oldPeers.isEmpty()) {
            return true;
        }
        
        Set<String> waitRemove = oldPeers;
        AtomicInteger successCnt = new AtomicInteger(0);
        multiRaftGroup.forEach(new BiConsumer<String, RaftGroupTuple>() {
            @Override
            public void accept(String group, RaftGroupTuple tuple) {
                Map<String, String> params = new HashMap<>();
                params.put(JRaftConstants.GROUP_ID, group);
                params.put(JRaftConstants.COMMAND_NAME, JRaftConstants.REMOVE_PEERS);
                params.put(JRaftConstants.COMMAND_VALUE, StringUtils.join(waitRemove, StringUtils.COMMA));
                RestResult<String> result = maintainService.execute(params);
                if (result.ok()) {
                    successCnt.incrementAndGet();
                } else {
                    Loggers.RAFT.error("Node removal failed : {}", result);
                }
            }
        });
        return successCnt.get() == multiRaftGroup.size();
    }
@Test
    void testPeerChange() {
        AtomicBoolean changed = new AtomicBoolean(false);
        
        JRaftMaintainService service = new JRaftMaintainService(server) {
            @Override
            public RestResult<String> execute(Map<String, String> args) {
                changed.set(true);
                return RestResultUtils.success();
            }
        };
        
        Collection<Member> firstEvent = Arrays.asList(Member.builder().ip("1.1.1.1").port(7848).build(),
                Member.builder().ip("127.0.0.1").port(80).build(), Member.builder().ip("127.0.0.2").port(81).build(),
                Member.builder().ip("127.0.0.3").port(82).build());
        server.peerChange(service, ProtocolManager.toCPMembersInfo(firstEvent));
        assertFalse(changed.get());
        changed.set(false);
        
        Collection<Member> secondEvent = Arrays.asList(Member.builder().ip("1.1.1.1").port(7848).build(),
                Member.builder().ip("127.0.0.1").port(80).build(), Member.builder().ip("127.0.0.2").port(81).build(),
                Member.builder().ip("127.0.0.4").port(83).build());
        server.peerChange(service, ProtocolManager.toCPMembersInfo(secondEvent));
        assertTrue(changed.get());
        changed.set(false);
        
        Collection<Member> thirdEvent = Arrays.asList(Member.builder().ip("1.1.1.1").port(7848).build(),
                Member.builder().ip("127.0.0.2").port(81).build(), Member.builder().ip("127.0.0.5").port(82).build());
        server.peerChange(service, ProtocolManager.toCPMembersInfo(thirdEvent));
        assertTrue(changed.get());
        changed.set(false);
        
        Collection<Member> fourEvent = Arrays.asList(Member.builder().ip("1.1.1.1").port(7848).build(),
                Member.builder().ip("127.0.0.1").port(80).build());
        server.peerChange(service, ProtocolManager.toCPMembersInfo(fourEvent));
        assertTrue(changed.get());
        changed.set(false);
        
        Collection<Member> fiveEvent = Arrays.asList(Member.builder().ip("1.1.1.1").port(7848).build(),
                Member.builder().ip("127.0.0.1").port(80).build(), Member.builder().ip("127.0.0.3").port(81).build());
        server.peerChange(service, ProtocolManager.toCPMembersInfo(fiveEvent));
        assertFalse(changed.get());
        changed.set(false);
    }