RaftNetworkClient implements RPCSender { @Override public void appendEntries(String server, long term, long commitIndex, long prevLogIndex, long prevLogTerm, @Nullable Collection<LogEntry> entries) throws RPCException { write(server, new AppendEntries(self.getId(), server, term, commitIndex, prevLogIndex, prevLogTerm, entries)); } RaftNetworkClient(
            Random random,
            Timer timer,
            ObjectMapper mapper,
            RaftMember self,
            Set<RaftMember> cluster,
            int connectTimeout,
            int minReconnectInterval,
            int additionalReconnectIntervalRange,
            TimeUnit timeUnit
    ); synchronized void initialize(
            ListeningExecutorService nonIoExecutorService,
            ServerChannelFactory serverChannelFactory,
            ChannelFactory clientChannelFactory,
            RPCReceiver receiver); synchronized void start(); synchronized void stop(); @Override void requestVote(String server, long term, long lastLogIndex, long lastLogTerm); @Override void requestVoteReply(String server, long term, boolean voteGranted); @Override void appendEntries(String server, long term, long commitIndex, long prevLogIndex, long prevLogTerm, @Nullable Collection<LogEntry> entries); @Override void appendEntriesReply(String server, long term, long prevLogIndex, long entryCount, boolean applied);  }
@Test public void shouldProduceAndConsumeHeartbeatAppendEntries() throws RPCException { client0.appendEntries(ClusterMembersFixture.RAFT_MEMBER_1.getId(), 10, 299, 300, 9, null); verifyNoMoreInteractions(client0RPCReceiver); verify(client1RPCReceiver).onAppendEntries(ClusterMembersFixture.RAFT_MEMBER_0.getId(), 10, 299, 300, 9, null); }
@Test public void shouldProduceAndConsumeNonHeartbeatAppendEntries() throws RPCException { List<LogEntry> entries = Lists.newArrayList( new LogEntry.NoopEntry(302, 10), new LogEntry.ClientEntry(303, 10, new UnitTestCommand()) ); client0.appendEntries(ClusterMembersFixture.RAFT_MEMBER_1.getId(), 10, 300, 301, 10, entries); verifyNoMoreInteractions(client0RPCReceiver); verify(client1RPCReceiver).onAppendEntries(ClusterMembersFixture.RAFT_MEMBER_0.getId(), 10, 300, 301, 10, entries); }