Interface ProtocolEngine

All Known Implementing Classes:
TransportProtocol

public interface ProtocolEngine
This interface defines the contract for a protocol implementation. An instance of this interface is created for each socket connection.
  • Field Details

    • BY_APPLICATION

      static final int BY_APPLICATION
      Disconnect reason: The application disconnected
      See Also:
  • Method Details

    • onSocketConnect

      void onSocketConnect(SocketConnection connection)
      The socket is connected and the protocol can now start.
      Parameters:
      connection - SocketConnection
    • onSocketClose

      void onSocketClose()
      The socket has closed.
    • onSocketRead

      boolean onSocketRead(ByteBuffer applicationData)
      Data has arrived on the socket.
      Parameters:
      applicationData - ByteBuffer
      Returns:
      boolean to determine if protocol wants to write to the socket
    • onSocketWrite

      SocketWriteCallback onSocketWrite(ByteBuffer applicationData)
      The socket is ready for writing.
      Parameters:
      applicationData - ByteBuffer
    • wantsToWrite

      boolean wantsToWrite()
      Determines whether the protocol wants to write to the socket. The value of this method determines the write state of the socket. Only return a true value when the protocol needs to write data to the socket.
      Returns:
      boolean
    • isConnected

      boolean isConnected()
      Is the protocol connected.
      Returns:
      boolean
    • getSocketConnection

      SocketConnection getSocketConnection()
      Get the SocketConnection for this connection.
      Returns:
      SocketConnection
    • disconnect

      void disconnect(int reason, String description)
      Disconnect the Engine
      Parameters:
      reason -
      description -
    • getConnectFuture

      ConnectRequestFuture getConnectFuture()
    • getDisconnectFuture

      DisconnectRequestFuture getDisconnectFuture()
    • getExecutor

      ExecutorOperationSupport<?> getExecutor()
    • getName

      String getName()
    • getContext

      SshContext getContext()
    • getConnection

      Connection<? extends SshContext> getConnection()