private static Uri ReadReplica([NotNull] BinaryBufferReader reader)
        {
            var host = reader.ReadString();
            var port = reader.ReadInt32();

            return(new Uri($"http://{host}:{port}"));
        }
Пример #2
0
        public void TrySerialize_should_correctly_serialize_record_given_sufficient_memory()
        {
            serializer.TrySerialize(item, itemSerializer, timestamp, buffer).Should().BeTrue();

            var reader = new BinaryBufferReader(buffer.InternalBuffer, 0);

            reader.ReadInt64().Should().Be(timestamp.ToUniversalTime().ToUnixTimeMilliseconds());
            reader.ReadInt32().Should().Be(10);
            reader.ReadString().Should().Be(item);
        }
Пример #3
0
        public void TryAppend_should_correctly_assemble_message_from_multiple_record_groups()
        {
            builder.TryAppend("key1", CreateGroupBufferSlice("message1"));
            builder.TryAppend("key2", CreateGroupBufferSlice("message22"));
            builder.TryAppend("key3", CreateGroupBufferSlice("message333"));

            builder.Message.Count.Should().Be(81);

            var reader = new BinaryBufferReader(buffer, 0);

            reader.ReadInt16().Should().Be(1);             // version
            reader.ReadInt32().Should().Be(3);             // groups count

            reader.ReadString().Should().Be("key1");       // routing key
            reader.ReadInt32().Should().Be(1);             // payload count
            reader.ReadString().Should().Be("message1");   // payload message

            reader.ReadString().Should().Be("key2");       // routing key
            reader.ReadInt32().Should().Be(1);             // payload count
            reader.ReadString().Should().Be("message22");  // payload message

            reader.ReadString().Should().Be("key3");       // routing key
            reader.ReadInt32().Should().Be(1);             // payload count
            reader.ReadString().Should().Be("message333"); // payload message
        }