public void Can_encode_findvalue_response()
        {
            var node    = new KNodeId32(1);
            var buffer  = new ArrayBufferWriter <byte>();
            var encoder = new KJsonMessageEncoder <KNodeId32>();
            var body    = new KFindValueResponse <KNodeId32>(new KNodeInfo <KNodeId32>[] { new KNodeInfo <KNodeId32>(node, new[] { new Uri("http://www.google.com") }) }, new KValueInfo(new byte[0], 1, DateTime.UtcNow.AddSeconds(.9)));
            var message = new KResponse <KNodeId32, KFindValueResponse <KNodeId32> >(new KMessageHeader <KNodeId32>(node, 1), KResponseStatus.Success, body);

            encoder.Encode(new KMessageContext <KNodeId32>("application/json".Yield()), buffer, new KMessageSequence <KNodeId32>(1, new IKMessage <KNodeId32>[] { message }));
            var j = JObject.Parse(Encoding.UTF8.GetString(buffer.WrittenSpan.ToArray()));
            var z = JObject.ReadFrom(new JsonTextReader(new StreamReader(typeof(KJsonMessageEncoderTests).Assembly.GetManifestResourceStream("Alethic.Kademlia.Tests.Json.Samples.findvalue_response.json"))));

            j.Should().BeEquivalentTo(z);
        }
        public void Can_encode_findvalue_request()
        {
            var node    = new KNodeId32(1);
            var buffer  = new ArrayBufferWriter <byte>();
            var encoder = new KJsonMessageEncoder <KNodeId32>();
            var message = new KFindValueRequest <KNodeId32>(node);
            var request = new KRequest <KNodeId32, KFindValueRequest <KNodeId32> >(new KMessageHeader <KNodeId32>(node, 1), message);

            encoder.Encode(new KMessageContext <KNodeId32>("application/json".Yield()), buffer, new KMessageSequence <KNodeId32>(1, new IKMessage <KNodeId32>[] { request }));
            var j = JObject.Parse(Encoding.UTF8.GetString(buffer.WrittenSpan.ToArray()));
            var z = JObject.ReadFrom(new JsonTextReader(new StreamReader(typeof(KJsonMessageEncoderTests).Assembly.GetManifestResourceStream("Alethic.Kademlia.Tests.Json.Samples.findvalue_request.json"))));

            j.Should().BeEquivalentTo(z);
        }