IoSession
public class ProtocolCodecSession extends DummySession
IoSession
that provides ProtocolEncoderOutput
and ProtocolDecoderOutput
. It is useful for unit-testing
codec and reusing codec for non-network-use (e.g. serialization).
ProtocolCodecSession session = new ProtocolCodecSession(); ProtocolEncoder encoder = ...; MessageX in = ...; encoder.encode(session, in, session.getProtocolEncoderOutput()); IoBuffer buffer = session.getProtocolDecoderOutputQueue().poll();
ProtocolCodecSession session = new ProtocolCodecSession(); ProtocolDecoder decoder = ...; IoBuffer in = ...; decoder.decode(session, in, session.getProtocolDecoderOutput()); Object message = session.getProtocolDecoderOutputQueue().poll();
CLOSE_REQUEST, MESSAGE_SENT_REQUEST
Constructor | Description |
---|---|
ProtocolCodecSession() |
Creates a new instance.
|
Modifier and Type | Method | Description |
---|---|---|
ProtocolDecoderOutput |
getDecoderOutput() |
|
Queue<Object> |
getDecoderOutputQueue() |
|
ProtocolEncoderOutput |
getEncoderOutput() |
|
Queue<Object> |
getEncoderOutputQueue() |
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, 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
getConfig, getFilterChain, getHandler, getLocalAddress, getProcessor, getRemoteAddress, getService, getTransportMetadata, setConfig, setHandler, setLocalAddress, setRemoteAddress, setScheduledWriteBytes, setScheduledWriteMessages, setService, setTransportMetadata, updateThroughput
public ProtocolEncoderOutput getEncoderOutput()
ProtocolEncoderOutput
that buffers
IoBuffer
s generated by ProtocolEncoder
.public Queue<Object> getEncoderOutputQueue()
Queue
of the buffered encoder output.public ProtocolDecoderOutput getDecoderOutput()
ProtocolEncoderOutput
that buffers
messages generated by ProtocolDecoder
.Copyright © 2004–2018 Apache MINA Project. All rights reserved.