org.apache.mina.common
Class DummySession

java.lang.Object
  extended by org.apache.mina.common.AbstractIoSession
      extended by org.apache.mina.common.DummySession
All Implemented Interfaces:
IoSession
Direct Known Subclasses:
ProtocolCodecSession

public class DummySession
extends AbstractIoSession

A dummy IoSession for unit-testing or non-network-use of the classes that depends on IoSession.

Overriding I/O request methods

All I/O request methods (i.e. AbstractIoSession.close(), AbstractIoSession.write(Object) and AbstractIoSession.setTrafficMask(TrafficMask)) are final and therefore cannot be overridden, but you can always add your custom IoFilter to the IoFilterChain to intercept any I/O events and requests.

Version:
$Rev: 607170 $, $Date: 2007-12-28 05:01:22 +0100 (Fri, 28 Dec 2007) $
Author:
The Apache MINA Project (dev@mina.apache.org)

Constructor Summary
DummySession()
          Creates a new instance.
 
Method Summary
 IoSessionConfig getConfig()
          Returns the configuration of this session.
 IoFilterChain getFilterChain()
          Returns the filter chain that only affects this session.
 IoHandler getHandler()
          Returns the IoHandler which handles this session.
 SocketAddress getLocalAddress()
          Returns the socket address of local machine which is associated with this session.
protected  IoProcessor<IoSession> getProcessor()
           
 SocketAddress getRemoteAddress()
          Returns the socket address of remote peer.
 IoService getService()
          Returns the IoService which provides I/O service to this session.
 TransportMetadata getTransportMetadata()
          Returns the TransportMetadata that this session runs on.
 void setConfig(IoSessionConfig config)
          Sets the configuration of this session.
 void setHandler(IoHandler handler)
          Sets the IoHandler which handles this session.
 void setLocalAddress(SocketAddress localAddress)
          Sets the socket address of local machine which is associated with this session.
 void setRemoteAddress(SocketAddress remoteAddress)
          Sets the socket address of remote peer.
 void setScheduledWriteBytes(long byteCount)
           
 void setScheduledWriteMessages(int messages)
           
 void setService(IoService service)
          Sets the IoService which provides I/O service to this session.
 void setTransportMetadata(TransportMetadata transportMetadata)
          Sets the TransportMetadata that this session runs on.
 void updateThroughput(boolean force)
          Update all statistical properties related with throughput.
 
Methods inherited from class org.apache.mina.common.AbstractIoSession
close, close, closeOnFlush, containsAttribute, decreaseReadBufferSize, decreaseScheduledBytesAndMessages, equals, getAttachment, getAttribute, getAttribute, getAttributeKeys, getAttributeMap, getBothIdleCount, getCloseFuture, getCreationTime, getCurrentWriteRequest, getId, getIdleCount, getLastBothIdleTime, getLastIdleTime, getLastIoTime, getLastReaderIdleTime, getLastReadTime, getLastWriterIdleTime, getLastWriteTime, getReadBytes, getReadBytesThroughput, getReaderIdleCount, getReadMessages, getReadMessagesThroughput, getScheduledWriteBytes, getScheduledWriteMessages, getServiceAddress, getTrafficMask, getWriteRequestQueue, getWriterIdleCount, getWrittenBytes, getWrittenBytesThroughput, getWrittenMessages, getWrittenMessagesThroughput, hashCode, increaseIdleCount, increaseReadBufferSize, increaseReadBytes, increaseReadMessages, increaseScheduledWriteBytes, increaseScheduledWriteMessages, increaseWrittenBytesAndMessages, isBothIdle, isClosing, isConnected, isIdle, isReaderIdle, isScheduledForFlush, isWriterIdle, offerClosedReadFuture, offerFailedReadFuture, offerReadFuture, read, removeAttribute, removeAttribute, replaceAttribute, resumeRead, resumeWrite, setAttachment, setAttribute, setAttribute, setAttributeIfAbsent, setAttributeIfAbsent, setAttributeMap, setCurrentWriteRequest, setScheduledForFlush, setTrafficMask, setTrafficMaskNow, setWriteRequestQueue, suspendRead, suspendWrite, toString, updateThroughput, write, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DummySession

public DummySession()
Creates a new instance.

Method Detail

getConfig

public IoSessionConfig getConfig()
Description copied from interface: IoSession
Returns the configuration of this session.


setConfig

public void setConfig(IoSessionConfig config)
Sets the configuration of this session.


getFilterChain

public IoFilterChain getFilterChain()
Description copied from interface: IoSession
Returns the filter chain that only affects this session.


getHandler

public IoHandler getHandler()
Description copied from interface: IoSession
Returns the IoHandler which handles this session.


setHandler

public void setHandler(IoHandler handler)
Sets the IoHandler which handles this session.


getLocalAddress

public SocketAddress getLocalAddress()
Description copied from interface: IoSession
Returns the socket address of local machine which is associated with this session.


getRemoteAddress

public SocketAddress getRemoteAddress()
Description copied from interface: IoSession
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.


setRemoteAddress

public void setRemoteAddress(SocketAddress remoteAddress)
Sets the socket address of remote peer.


getService

public IoService getService()
Description copied from interface: IoSession
Returns the IoService which provides I/O service to this session.


setService

public void setService(IoService service)
Sets the IoService which provides I/O service to this session.


getProcessor

protected final IoProcessor<IoSession> getProcessor()
Specified by:
getProcessor in class AbstractIoSession

getTransportMetadata

public TransportMetadata getTransportMetadata()
Description copied from interface: IoSession
Returns the TransportMetadata that this session runs on.


setTransportMetadata

public void setTransportMetadata(TransportMetadata transportMetadata)
Sets the TransportMetadata that this session runs on.


setScheduledWriteBytes

public void setScheduledWriteBytes(long byteCount)
Overrides:
setScheduledWriteBytes in class AbstractIoSession

setScheduledWriteMessages

public void setScheduledWriteMessages(int messages)
Overrides:
setScheduledWriteMessages in class AbstractIoSession

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 last calculation interval. If, however, force is specified as true, this method updates the throughput properties immediately.



Copyright © 2004-2009 Apache MINA Project. All Rights Reserved.