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.
  • Field Details

    • attributes

      protected final Map<Object,Object> attributes
    • service

      protected final NettyIoService 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

      protected SocketAddress remoteAddr
    • prev

      protected io.netty.channel.ChannelFuture prev
    • adapter

      protected final io.netty.channel.ChannelInboundHandlerAdapter adapter
    • readSuspended

      protected final AtomicBoolean readSuspended
    • acceptanceAddress

      private final SocketAddress 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:
      getId in interface org.apache.sshd.common.io.IoSession
    • getAttribute

      public Object getAttribute(Object key)
      Specified by:
      getAttribute in interface org.apache.sshd.common.io.IoSession
    • setAttribute

      public Object setAttribute(Object key, Object value)
      Specified by:
      setAttribute in interface org.apache.sshd.common.io.IoSession
    • setAttributeIfAbsent

      public Object setAttributeIfAbsent(Object key, Object value)
      Specified by:
      setAttributeIfAbsent in interface org.apache.sshd.common.io.IoSession
    • removeAttribute

      public Object removeAttribute(Object key)
      Specified by:
      removeAttribute in interface org.apache.sshd.common.io.IoSession
    • getRemoteAddress

      public SocketAddress getRemoteAddress()
      Specified by:
      getRemoteAddress in interface org.apache.sshd.common.util.net.ConnectionEndpointsIndicator
    • getLocalAddress

      public SocketAddress getLocalAddress()
      Specified by:
      getLocalAddress in interface org.apache.sshd.common.util.net.ConnectionEndpointsIndicator
    • getAcceptanceAddress

      public SocketAddress getAcceptanceAddress()
      Specified by:
      getAcceptanceAddress in interface org.apache.sshd.common.io.IoSession
    • writeBuffer

      public org.apache.sshd.common.io.IoWriteFuture writeBuffer(org.apache.sshd.common.util.buffer.Buffer buffer)
      Specified by:
      writeBuffer in interface org.apache.sshd.common.io.IoSession
    • getService

      public org.apache.sshd.common.io.IoService getService()
      Specified by:
      getService in interface org.apache.sshd.common.io.IoSession
    • suspendRead

      public void suspendRead()
      Specified by:
      suspendRead in interface org.apache.sshd.common.io.IoSession
    • resumeRead

      public void resumeRead()
      Specified by:
      resumeRead in interface org.apache.sshd.common.io.IoSession
    • shutdownOutputStream

      public void shutdownOutputStream() throws IOException
      Specified by:
      shutdownOutputStream in interface org.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:
      doCloseGracefully in class org.apache.sshd.common.util.closeable.AbstractCloseable
    • doCloseImmediately

      protected void doCloseImmediately()
      Overrides:
      doCloseImmediately in class org.apache.sshd.common.util.closeable.AbstractCloseable
    • channelActive

      protected void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Throws:
      Exception
    • channelInactive

      protected void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Throws:
      Exception
    • channelRead

      protected void channelRead(io.netty.channel.ChannelHandlerContext ctx, org.apache.sshd.common.util.Readable msg) throws Exception
      Throws:
      Exception
    • exceptionCaught

      protected void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception
      Throws:
      Exception
    • toString

      public String toString()
      Overrides:
      toString in class Object