Package org.apache.mina.core.session
Class DummySession
- java.lang.Object
-
- org.apache.mina.core.session.AbstractIoSession
-
- org.apache.mina.core.session.DummySession
-
- All Implemented Interfaces:
IoSession
- Direct Known Subclasses:
ProtocolCodecSession
public class DummySession extends AbstractIoSession
A dummyIoSessionfor unit-testing or non-network-use of the classes that depends onIoSession.Overriding I/O request methods
All I/O request methods (i.e.AbstractIoSession.close(),AbstractIoSession.write(Object)are final and therefore cannot be overridden, but you can always add your customIoFilterto theIoFilterChainto intercept any I/O events and requests.- 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 DummySession()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IoSessionConfiggetConfig()IoFilterChaingetFilterChain()IoHandlergetHandler()SocketAddressgetLocalAddress()IoProcessor<IoSession>getProcessor()SocketAddressgetRemoteAddress()IoServicegetService()TransportMetadatagetTransportMetadata()voidsetConfig(IoSessionConfig config)Sets the configuration of this session.voidsetHandler(IoHandler handler)Sets theIoHandlerwhich handles this session.voidsetLocalAddress(SocketAddress localAddress)Sets the socket address of local machine which is associated with this session.voidsetRemoteAddress(SocketAddress remoteAddress)Sets the socket address of remote peer.voidsetScheduledWriteBytes(int byteCount)Set the number of scheduled write bytesvoidsetScheduledWriteMessages(int messages)Set the number of scheduled write messagesvoidsetService(IoService service)Sets theIoServicewhich provides I/O service to this session.voidsetTransportMetadata(TransportMetadata transportMetadata)Sets theTransportMetadatathat this session runs on.voidupdateThroughput(boolean force)Update all statistical properties related with throughput.-
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
-
getConfig
public IoSessionConfig getConfig()
- Specified by:
getConfigin interfaceIoSession- Overrides:
getConfigin classAbstractIoSession- Returns:
- the configuration of this session.
-
setConfig
public void setConfig(IoSessionConfig config)
Sets the configuration of this session.- Parameters:
config- theIoSessionConfigto set
-
getFilterChain
public IoFilterChain getFilterChain()
- Returns:
- the filter chain that only affects this session.
-
getHandler
public IoHandler getHandler()
- Specified by:
getHandlerin interfaceIoSession- Overrides:
getHandlerin classAbstractIoSession- Returns:
- the
IoHandlerwhich handles this session.
-
setHandler
public void setHandler(IoHandler handler)
Sets theIoHandlerwhich handles this session.- Parameters:
handler- theIoHandlerto set
-
getLocalAddress
public SocketAddress getLocalAddress()
- Returns:
- the socket address of local machine which is associated with this session.
-
getRemoteAddress
public SocketAddress getRemoteAddress()
- Returns:
- the socket address of remote peer.
-
setLocalAddress
public void setLocalAddress(SocketAddress localAddress)
Sets the socket address of local machine which is associated with this session.- Parameters:
localAddress- The socket address to set
-
setRemoteAddress
public void setRemoteAddress(SocketAddress remoteAddress)
Sets the socket address of remote peer.- Parameters:
remoteAddress- The socket address to set
-
getService
public IoService getService()
- Specified by:
getServicein interfaceIoSession- Overrides:
getServicein classAbstractIoSession- Returns:
- the
IoServicewhich provides I/O service to this session.
-
setService
public void setService(IoService service)
Sets theIoServicewhich provides I/O service to this session.- Parameters:
service- TheIoServiceto set
-
getProcessor
public final IoProcessor<IoSession> getProcessor()
- Specified by:
getProcessorin classAbstractIoSession- Returns:
- The associated IoProcessor for this session
-
getTransportMetadata
public TransportMetadata getTransportMetadata()
- Returns:
- the
TransportMetadatathat this session runs on.
-
setTransportMetadata
public void setTransportMetadata(TransportMetadata transportMetadata)
Sets theTransportMetadatathat this session runs on.- Parameters:
transportMetadata- TheTransportMetadatato set
-
setScheduledWriteBytes
public void setScheduledWriteBytes(int byteCount)
Set the number of scheduled write bytes- Overrides:
setScheduledWriteBytesin classAbstractIoSession- Parameters:
byteCount- The number of scheduled bytes for write
-
setScheduledWriteMessages
public void setScheduledWriteMessages(int messages)
Set the number of scheduled write messages- Overrides:
setScheduledWriteMessagesin classAbstractIoSession- Parameters:
messages- The number of scheduled messages for write
-
updateThroughput
public void updateThroughput(boolean force)
Update all statistical properties related with throughput. By default this method returns silently without updating the throughput properties if they were calculated already within lastcalculation interval. If, however,forceis specified astrue, this method updates the throughput properties immediately.- Parameters:
force- the flag that forces the update of properties immediately iftrue
-
-