private void TestDecoderAndInputStream(String expected, IoBuffer input) { // Test ProtocolDecoder IProtocolDecoder decoder = new ObjectSerializationDecoder(); ProtocolCodecSession session = new ProtocolCodecSession(); IProtocolDecoderOutput decoderOut = session.DecoderOutput; decoder.Decode(session, input.Duplicate(), decoderOut); Assert.AreEqual(1, session.DecoderOutputQueue.Count); Assert.AreEqual(expected, session.DecoderOutputQueue.Dequeue()); }
/// <inheritdoc/> public override IoBuffer Duplicate() { return(_buf.Duplicate()); }
private void InternalFlush(INextFilter nextFilter, IoSession session, IoBuffer buf) { IoBuffer tmp = null; lock (buf) { buf.Flip(); tmp = buf.Duplicate(); buf.Clear(); } if (log.IsDebugEnabled) log.Debug("Flushing buffer: " + tmp); nextFilter.FilterWrite(session, new DefaultWriteRequest(tmp)); }
protected override Boolean DoDecode(IoSession session, IoBuffer input, IProtocolDecoderOutput output) { input.Duplicate(); // Will disable auto-expansion. Assert.IsFalse(input.AutoExpand); return base.DoDecode(session, input, output); }