Class TelnetConnection

java.lang.Object
org.aesh.terminal.telnet.TelnetConnection
Direct Known Subclasses:
NettyTelnetConnection

public abstract class TelnetConnection extends Object
Author:
Julien Viet
  • Field Details

  • Constructor Details

    • TelnetConnection

      public TelnetConnection(TelnetHandler handler)
  • Method Details

    • onInit

      public void onInit()
    • close

      public abstract void close()
    • writeDoOption

      public final void writeDoOption(Option option)
      Write a do option request to the client.
      Parameters:
      option - the option to send
    • writeWillOption

      public final void writeWillOption(Option option)
      Write a do will request to the client.
      Parameters:
      option - the option to send
    • execute

      protected abstract void execute(Runnable task)
    • schedule

      protected abstract void schedule(Runnable task, long delay, TimeUnit unit)
    • send

      protected abstract void send(byte[] data)
    • receive

      public void receive(byte[] data)
    • write

      public final void write(byte[] data)
      Write data to the client, escaping data if necessary or truncating it. The original buffer can be mutated if incorrect data is provided.
      Parameters:
      data - the data to write
    • onClose

      protected void onClose()
    • onOptionWill

      protected void onOptionWill(byte optionCode)
      Handle option WILL call back. The implementation will try to find a matching option via the Option#values() and invoke it's Option.handleWill(TelnetConnection) method otherwise a DON'T will be sent to the client.

      This method can be subclassed to handle an option.

      Parameters:
      optionCode - the option code
    • onOptionWont

      protected void onOptionWont(byte optionCode)
      Handle option WON'T call back. The implementation will try to find a matching option via the Option#values() and invoke it's Option.handleWont(TelnetConnection) method.

      This method can be subclassed to handle an option.

      Parameters:
      optionCode - the option code
    • onOptionDo

      protected void onOptionDo(byte optionCode)
      Handle option DO call back. The implementation will try to find a matching option via the Option#values() and invoke it's Option.handleDo(TelnetConnection) method otherwise a WON'T will be sent to the client.

      This method can be subclassed to handle an option.

      Parameters:
      optionCode - the option code
    • onOptionDont

      protected void onOptionDont(byte optionCode)
      Handle option DON'T call back. The implementation will try to find a matching option via the Option#values() and invoke it's Option.handleDont(TelnetConnection) method.

      This method can be subclassed to handle an option.

      Parameters:
      optionCode - the option code
    • onOptionParameters

      protected void onOptionParameters(byte optionCode, byte[] parameters)
      Handle option parameters call back. The implementation will try to find a matching option via the Option#values() and invoke it's Option.handleParameters(TelnetConnection, byte[]) method. This method can be subclassed to handle an option.
      Parameters:
      optionCode - the option code