public void ForwardAndRead()
        {
            var buffer = Encoding.ASCII.GetBytes("0123456789");
            var worker = new BufferWriter();
            worker.Assign(new BufferSlice(buffer, 0, buffer.Length));

            worker.Forward(4);
            Assert.Equal('4', (char) worker.Buffer[worker.Position]);
        }
        public void Writes()
        {
            var buffer = Encoding.ASCII.GetBytes("0123456789");
            var worker = new BufferWriter();
            worker.Assign(new BufferSlice(new byte[65535], 0, 65535));

            worker.Write(buffer, 0, 5);

            Assert.Equal('4', (char) worker.Buffer[worker.Position]);
        }
        /// <summary>
        /// Send a message
        /// </summary>
        /// <param name="message">Message to send</param>
        /// <remarks>Message will be serialized using the <see cref="IMessageFormatterFactory"/> that you've specified in the constructor.</remarks>
        public void Send(object message)
        {
            if (message == null) throw new ArgumentNullException("message");

            var serializer = _formatterFactory.CreateSerializer();
            var buffer = new BufferSlice(65535);
            var writer = new BufferWriter(buffer);
            serializer.Serialize(message, writer);

            Send(buffer, writer.Count);
        }
 public void Init()
 {
     var buffer = Encoding.ASCII.GetBytes("0123456789");
     var worker = new BufferWriter();
     worker.Assign(new BufferSlice(buffer, 0, buffer.Length));
 }