Class Nio2Session

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.common.io.nio2.Nio2Session
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 Nio2Session extends org.apache.sshd.common.util.closeable.AbstractCloseable implements org.apache.sshd.common.io.IoSession
Author:
Apache MINA SSHD Project
  • Field Details

  • Constructor Details

  • 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
    • getSocket

      public AsynchronousSocketChannel getSocket()
    • getIoHandler

      public org.apache.sshd.common.io.IoHandler getIoHandler()
    • suspend

      public void suspend()
      Intended for tests simulating a sudden connection drop only! Do not call otherwise.
    • writeBuffer

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

      protected void exceptionCaught(Throwable exc)
    • 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
    • getService

      public Nio2Service getService()
      Specified by:
      getService 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
    • doShutdownOutputStream

      protected void doShutdownOutputStream(Nio2DefaultIoWriteFuture future, AsynchronousSocketChannel socket) throws IOException
      Throws:
      IOException
    • startReading

      public void startReading()
    • startReading

      public void startReading(int bufSize)
    • startReading

      public void startReading(byte[] buf)
    • startReading

      public void startReading(byte[] buf, int offset, int len)
    • startReading

      public void startReading(ByteBuffer buffer)
    • doReadCycle

      protected void doReadCycle(ByteBuffer buffer, org.apache.sshd.common.util.Readable bufReader)
    • createReadCycleCompletionHandler

      protected Nio2CompletionHandler<Integer,Object> createReadCycleCompletionHandler(ByteBuffer buffer, org.apache.sshd.common.util.Readable bufReader)
    • handleReadCycleCompletion

      protected void handleReadCycleCompletion(ByteBuffer buffer, org.apache.sshd.common.util.Readable bufReader, Nio2CompletionHandler<Integer,Object> completionHandler, Integer result, Object attachment)
    • handleReadCycleFailure

      protected void handleReadCycleFailure(ByteBuffer buffer, org.apache.sshd.common.util.Readable bufReader, Throwable exc, Object attachment)
    • 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
    • doReadCycle

      protected void doReadCycle(ByteBuffer buffer, Nio2CompletionHandler<Integer,Object> completion)
    • startWriting

      protected void startWriting()
    • doWriteCycle

      protected void doWriteCycle(ByteBuffer buffer, Nio2CompletionHandler<Integer,Object> completion)
    • createWriteCycleCompletionHandler

      protected Nio2CompletionHandler<Integer,Object> createWriteCycleCompletionHandler(Nio2DefaultIoWriteFuture future, AsynchronousSocketChannel socket, ByteBuffer buffer)
    • handleCompletedWriteCycle

      protected void handleCompletedWriteCycle(Nio2DefaultIoWriteFuture future, AsynchronousSocketChannel socket, ByteBuffer buffer, int writeLen, Nio2CompletionHandler<Integer,Object> completionHandler, Integer result, Object attachment)
    • handleWriteCycleFailure

      protected void handleWriteCycleFailure(Nio2DefaultIoWriteFuture future, AsynchronousSocketChannel socket, ByteBuffer buffer, int writeLen, Throwable exc, Object attachment)
    • finishWrite

      protected void finishWrite(Nio2DefaultIoWriteFuture future)
    • toString

      public String toString()
      Overrides:
      toString in class Object