public void TestBasicBuffering() { DummySession sess = new DummySession(); sess.FilterChain.AddFirst("peer", new DummyFilter()); sess.FilterChain.AddFirst("logger", new LoggingFilter()); BufferedWriteFilter bFilter = new BufferedWriteFilter(10); sess.FilterChain.AddLast("buffer", bFilter); IoBuffer data = IoBuffer.Allocate(1); for (byte i = 0; i < 20; i++) { data.Put((byte)(0x30 + i)); data.Flip(); sess.Write(data); data.Clear(); } // Add one more byte to overflow the final buffer data.Put((byte)0); data.Flip(); sess.Write(data); // Flush the final byte bFilter.Flush(sess); sess.Close(true); }
public void TestBasicBuffering() { DummySession sess = new DummySession(); sess.FilterChain.AddFirst("peer", new DummyFilter()); sess.FilterChain.AddFirst("logger", new LoggingFilter()); BufferedWriteFilter bFilter = new BufferedWriteFilter(10); sess.FilterChain.AddLast("buffer", bFilter); IoBuffer data = IoBuffer.Allocate(1); for (byte i = 0; i < 20; i++) { data.Put((byte)(0x30 + i)); data.Flip(); sess.Write(data); data.Clear(); } // Add one more byte to overflow the final buffer data.Put((byte)0); data.Flip(); sess.Write(data); // Flush the final byte bFilter.Flush(sess); sess.Close(true); }