Class NioSocketSession
- java.lang.Object
-
- org.apache.mina.core.session.AbstractIoSession
-
- org.apache.mina.transport.socket.nio.NioSession
-
- org.apache.mina.transport.socket.nio.NioSocketSession
-
- All Implemented Interfaces:
IoSession
class NioSocketSession extends NioSession
AnIoSessionfor socket transport (TCP/IP).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classNioSocketSession.SessionConfigImplA private class storing a copy of the IoService configuration when the IoSession is created.
-
Field Summary
Fields Modifier and Type Field Description (package private) static TransportMetadataMETADATA-
Fields inherited from class org.apache.mina.transport.socket.nio.NioSession
channel, processor
-
Fields inherited from class org.apache.mina.core.session.AbstractIoSession
CLOSE_REQUEST, config, MESSAGE_SENT_REQUEST
-
-
Constructor Summary
Constructors Constructor Description NioSocketSession(IoService service, IoProcessor<NioSession> processor, java.nio.channels.SocketChannel channel)Creates a new instance of NioSocketSession.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.nio.channels.SocketChannelgetChannel()SocketSessionConfiggetConfig()java.net.InetSocketAddressgetLocalAddress()java.net.InetSocketAddressgetRemoteAddress()java.net.InetSocketAddressgetServiceAddress()private java.net.SocketgetSocket()TransportMetadatagetTransportMetadata()booleanisSecured()-
Methods inherited from class org.apache.mina.transport.socket.nio.NioSession
getFilterChain, getProcessor, getSelectionKey, isActive, setSelectionKey
-
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, getHandler, getId, getIdleCount, getLastBothIdleTime, getLastIdleTime, getLastIoTime, getLastReaderIdleTime, getLastReadTime, getLastWriterIdleTime, getLastWriteTime, getReadBytes, getReadBytesThroughput, getReaderIdleCount, getReadMessages, getReadMessagesThroughput, getScheduledWriteBytes, getScheduledWriteMessages, getService, getWriteRequestQueue, getWriterIdleCount, getWrittenBytes, getWrittenBytesThroughput, getWrittenMessages, getWrittenMessagesThroughput, hashCode, increaseIdleCount, increaseReadBufferSize, increaseReadBytes, increaseReadMessages, increaseScheduledWriteBytes, increaseScheduledWriteMessages, increaseWrittenBytes, increaseWrittenMessages, isBothIdle, isClosing, isConnected, isIdle, isReaderIdle, isReadSuspended, isScheduledForFlush, isWriterIdle, isWriteSuspended, notifyIdleness, notifyIdleSession, offerClosedReadFuture, offerFailedReadFuture, offerReadFuture, read, removeAttribute, removeAttribute, replaceAttribute, resumeRead, resumeWrite, scheduledForFlush, setAttachment, setAttribute, setAttribute, setAttributeIfAbsent, setAttributeIfAbsent, setAttributeMap, setCurrentWriteRequest, setScheduledForFlush, setScheduledWriteBytes, setScheduledWriteMessages, setWriteRequestQueue, suspendRead, suspendWrite, toString, unscheduledForFlush, updateThroughput, write, write
-
-
-
-
Field Detail
-
METADATA
static final TransportMetadata METADATA
-
-
Constructor Detail
-
NioSocketSession
public NioSocketSession(IoService service, IoProcessor<NioSession> processor, java.nio.channels.SocketChannel channel)
Creates a new instance of NioSocketSession.- Parameters:
service- the associated IoServiceprocessor- the associated IoProcessorchannel- the used channel
-
-
Method Detail
-
getSocket
private java.net.Socket getSocket()
-
getTransportMetadata
public TransportMetadata getTransportMetadata()
- Returns:
- the
TransportMetadatathat this session runs on.
-
getConfig
public SocketSessionConfig getConfig()
- Specified by:
getConfigin interfaceIoSession- Overrides:
getConfigin classAbstractIoSession- Returns:
- the configuration of this session.
-
getChannel
java.nio.channels.SocketChannel getChannel()
- Specified by:
getChannelin classNioSession- Returns:
- The ByteChannel associated with this
IoSession
-
getRemoteAddress
public java.net.InetSocketAddress getRemoteAddress()
- Returns:
- the socket address of remote peer.
-
getLocalAddress
public java.net.InetSocketAddress getLocalAddress()
- Returns:
- the socket address of local machine which is associated with this session.
-
getServiceAddress
public java.net.InetSocketAddress getServiceAddress()
Description copied from class:AbstractIoSession- Specified by:
getServiceAddressin interfaceIoSession- Overrides:
getServiceAddressin classAbstractIoSession- Returns:
- the socket address of the
IoServicelistens to to manage this session. If this session is managed byIoAcceptor, it returns theSocketAddresswhich is specified as a parameter ofIoAcceptor.bind(). If this session is managed byIoConnector, this method returns the same address with that ofIoSession.getRemoteAddress().
-
isSecured
public final boolean isSecured()
- Specified by:
isSecuredin interfaceIoSession- Overrides:
isSecuredin classAbstractIoSession- Returns:
trueif the session has started and initialized a SslEngine,falseif the session is not yet secured (the handshake is not completed) or if SSL is not set for this session, or if SSL is not even an option.
-
-