Class NettyIoSession
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.util.closeable.IoBaseCloseable
org.apache.sshd.common.util.closeable.AbstractCloseable
org.apache.sshd.netty.NettyIoSession
- All Implemented Interfaces:
Closeable, AutoCloseable, Channel, org.apache.sshd.common.Closeable, org.apache.sshd.common.io.IoSession, org.apache.sshd.common.util.net.ConnectionEndpointsIndicator
public class NettyIoSession
extends org.apache.sshd.common.util.closeable.AbstractCloseable
implements org.apache.sshd.common.io.IoSession
The Netty based IoSession implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classNetty adapter to use as a bridge, with extra handling for suspending reads.protected static classNested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
org.apache.sshd.common.util.closeable.AbstractCloseable.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SocketAddressprotected final io.netty.channel.ChannelInboundHandlerAdapterprotected io.netty.channel.ChannelHandlerContextprotected final org.apache.sshd.common.io.IoHandlerprotected final longprotected io.netty.channel.ChannelFutureprotected final AtomicBooleanprotected SocketAddressprotected final NettyIoServiceFields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, stateFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
ConstructorsConstructorDescriptionNettyIoSession(NettyIoService service, org.apache.sshd.common.io.IoHandler handler, SocketAddress acceptanceAddress) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidchannelActive(io.netty.channel.ChannelHandlerContext ctx) protected voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) protected voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, org.apache.sshd.common.util.Readable msg) protected org.apache.sshd.common.future.CloseFutureprotected voidprotected voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) getAttribute(Object key) longgetId()org.apache.sshd.common.io.IoServiceremoveAttribute(Object key) voidsetAttribute(Object key, Object value) setAttributeIfAbsent(Object key, Object value) voidvoidsuspend()Intended for tests simulating a sudden connection drop only! Do not call otherwise.voidtoString()org.apache.sshd.common.io.IoWriteFuturewriteBuffer(org.apache.sshd.common.util.buffer.Buffer buffer) Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListenerMethods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, isClosed, isClosing, isOpen, removeCloseFutureListenerMethods inherited from interface org.apache.sshd.common.io.IoSession
close
-
Field Details
-
attributes
-
service
-
handler
protected final org.apache.sshd.common.io.IoHandler handler -
id
protected final long id -
context
protected volatile io.netty.channel.ChannelHandlerContext context -
remoteAddr
-
prev
protected io.netty.channel.ChannelFuture prev -
adapter
protected final io.netty.channel.ChannelInboundHandlerAdapter adapter -
readSuspended
-
acceptanceAddress
-
-
Constructor Details
-
NettyIoSession
public NettyIoSession(NettyIoService service, org.apache.sshd.common.io.IoHandler handler, SocketAddress acceptanceAddress)
-
-
Method Details
-
getId
public long getId()- Specified by:
getIdin interfaceorg.apache.sshd.common.io.IoSession
-
getAttribute
-
setAttribute
-
setAttributeIfAbsent
-
removeAttribute
-
getRemoteAddress
- Specified by:
getRemoteAddressin interfaceorg.apache.sshd.common.util.net.ConnectionEndpointsIndicator
-
getLocalAddress
- Specified by:
getLocalAddressin interfaceorg.apache.sshd.common.util.net.ConnectionEndpointsIndicator
-
getAcceptanceAddress
- Specified by:
getAcceptanceAddressin interfaceorg.apache.sshd.common.io.IoSession
-
writeBuffer
public org.apache.sshd.common.io.IoWriteFuture writeBuffer(org.apache.sshd.common.util.buffer.Buffer buffer) - Specified by:
writeBufferin interfaceorg.apache.sshd.common.io.IoSession
-
getService
public org.apache.sshd.common.io.IoService getService()- Specified by:
getServicein interfaceorg.apache.sshd.common.io.IoSession
-
suspendRead
public void suspendRead()- Specified by:
suspendReadin interfaceorg.apache.sshd.common.io.IoSession
-
resumeRead
public void resumeRead()- Specified by:
resumeReadin interfaceorg.apache.sshd.common.io.IoSession
-
shutdownOutputStream
- Specified by:
shutdownOutputStreamin interfaceorg.apache.sshd.common.io.IoSession- Throws:
IOException
-
suspend
public void suspend()Intended for tests simulating a sudden connection drop only! Do not call otherwise. -
doCloseGracefully
protected org.apache.sshd.common.future.CloseFuture doCloseGracefully()- Overrides:
doCloseGracefullyin classorg.apache.sshd.common.util.closeable.AbstractCloseable
-
doCloseImmediately
protected void doCloseImmediately()- Overrides:
doCloseImmediatelyin classorg.apache.sshd.common.util.closeable.AbstractCloseable
-
channelActive
-
channelInactive
-
channelRead
-
exceptionCaught
-
toString
-