Package org.apache.mina.filter.codec
Class ProtocolCodecSession
- java.lang.Object
-
- org.apache.mina.core.session.AbstractIoSession
-
- org.apache.mina.core.session.DummySession
-
- org.apache.mina.filter.codec.ProtocolCodecSession
-
- All Implemented Interfaces:
IoSession
public class ProtocolCodecSession extends DummySession
A virtualIoSessionthat providesProtocolEncoderOutputandProtocolDecoderOutput. It is useful for unit-testing codec and reusing codec for non-network-use (e.g. serialization).Encoding
ProtocolCodecSession session = new ProtocolCodecSession(); ProtocolEncoder encoder = ...; MessageX in = ...; encoder.encode(session, in, session.getProtocolEncoderOutput()); IoBuffer buffer = session.getProtocolDecoderOutputQueue().poll();
Decoding
ProtocolCodecSession session = new ProtocolCodecSession(); ProtocolDecoder decoder = ...; IoBuffer in = ...; decoder.decode(session, in, session.getProtocolDecoderOutput()); Object message = session.getProtocolDecoderOutputQueue().poll();
- Author:
- Apache MINA Project
-
-
Field Summary
-
Fields inherited from class org.apache.mina.core.session.AbstractIoSession
CLOSE_REQUEST, MESSAGE_SENT_REQUEST
-
-
Constructor Summary
Constructors Constructor Description ProtocolCodecSession()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProtocolDecoderOutputgetDecoderOutput()Queue<Object>getDecoderOutputQueue()ProtocolEncoderOutputgetEncoderOutput()Queue<Object>getEncoderOutputQueue()-
Methods inherited from class org.apache.mina.core.session.DummySession
getConfig, getFilterChain, getHandler, getLocalAddress, getProcessor, getRemoteAddress, getService, getTransportMetadata, setConfig, setHandler, setLocalAddress, setRemoteAddress, setScheduledWriteBytes, setScheduledWriteMessages, setService, setTransportMetadata, updateThroughput
-
Methods inherited from class org.apache.mina.core.session.AbstractIoSession
close, close, closeNow, closeOnFlush, containsAttribute, decreaseReadBufferSize, decreaseScheduledBytesAndMessages, destroy, equals, getAttachment, getAttribute, getAttribute, getAttributeKeys, getAttributeMap, getBothIdleCount, getCloseFuture, getCreationTime, getCurrentWriteMessage, getCurrentWriteRequest, getId, getIdleCount, getLastBothIdleTime, getLastIdleTime, getLastIoTime, getLastReaderIdleTime, getLastReadTime, getLastWriterIdleTime, getLastWriteTime, getReadBytes, getReadBytesThroughput, getReaderIdleCount, getReadMessages, getReadMessagesThroughput, getScheduledWriteBytes, getScheduledWriteMessages, getServiceAddress, getWriteRequestQueue, getWriterIdleCount, getWrittenBytes, getWrittenBytesThroughput, getWrittenMessages, getWrittenMessagesThroughput, hashCode, increaseIdleCount, increaseReadBufferSize, increaseReadBytes, increaseReadMessages, increaseScheduledWriteBytes, increaseScheduledWriteMessages, increaseWrittenBytes, increaseWrittenMessages, isActive, isBothIdle, isClosing, isConnected, isIdle, isReaderIdle, isReadSuspended, isScheduledForFlush, isSecured, isServer, isWriterIdle, isWriteSuspended, notifyIdleness, notifyIdleSession, offerClosedReadFuture, offerFailedReadFuture, offerReadFuture, read, removeAttribute, removeAttribute, replaceAttribute, resumeRead, resumeWrite, scheduledForFlush, setAttachment, setAttribute, setAttribute, setAttributeIfAbsent, setAttributeIfAbsent, setAttributeMap, setCurrentWriteRequest, setScheduledForFlush, setWriteRequestQueue, suspendRead, suspendWrite, toString, unscheduledForFlush, updateThroughput, write, write
-
-
-
-
Method Detail
-
getEncoderOutput
public ProtocolEncoderOutput getEncoderOutput()
- Returns:
- the
ProtocolEncoderOutputthat buffersIoBuffers generated byProtocolEncoder.
-
getEncoderOutputQueue
public Queue<Object> getEncoderOutputQueue()
- Returns:
- the
Queueof the buffered encoder output.
-
getDecoderOutput
public ProtocolDecoderOutput getDecoderOutput()
- Returns:
- the
ProtocolEncoderOutputthat buffers messages generated byProtocolDecoder.
-
-