public void CanInstallSnapshot() { using (var node2Transport = new HttpTransport("node2", _requestsTimeout, CancellationToken.None)) { var node1 = new NodeConnectionInfo { Name = "node1", Uri = new Uri("http://localhost:9079") }; node2Transport.Send(node1, new CanInstallSnapshotRequest { From = "node2", ClusterTopologyId = new Guid("355a589b-cadc-463d-a515-5add2ea47205"), Term = 2, Index = 3, }); MessageContext context; var gotIt = node2Transport.TryReceiveMessage(_timeout, CancellationToken.None, out context); Assert.True(gotIt); Assert.True(context.Message is CanInstallSnapshotResponse); node2Transport.Stream(node1, new InstallSnapshotRequest { From = "node2", ClusterTopologyId = new Guid("355a589b-cadc-463d-a515-5add2ea47205"), Term = 2, Topology = new Topology(new Guid("355a589b-cadc-463d-a515-5add2ea47205")), LastIncludedIndex = 2, LastIncludedTerm = 2, }, stream => { var streamWriter = new StreamWriter(stream); var data = new Dictionary <string, int> { { "a", 2 } }; new JsonSerializer().Serialize(streamWriter, data); streamWriter.Flush(); }); gotIt = node2Transport.TryReceiveMessage(_timeout, CancellationToken.None, out context); Assert.True(gotIt); var appendEntriesResponse = (InstallSnapshotResponse)context.Message; Assert.True(appendEntriesResponse.Success); Assert.Equal(2, ((DictionaryStateMachine)_raftEngine.StateMachine).Data["a"]); } }