Class LoopbackConnectionHandler

java.lang.Object
org.tentackle.trip.transport.ConnectionHandler
org.tentackle.trip.transport.LoopbackConnectionHandler
All Implemented Interfaces:
Runnable

public class LoopbackConnectionHandler extends ConnectionHandler
Loopback connection handler for testing purposes.
  • Constructor Details

    • LoopbackConnectionHandler

      public LoopbackConnectionHandler(LoopbackTransport transport, String name, InputStream inputStream, OutputStream outputStream)
      Creates a new handler.
      Parameters:
      transport - the transport associated with this handler
      name - the name of the connection
      inputStream - the input stream associated with this connection
      outputStream - the output stream associated with this connection
  • Method Details

    • createStream

      protected TripStream createStream(UUID id, boolean clientDictionaryEmpty)
      Description copied from class: ConnectionHandler
      Creates a new stream for the given UUID.
      Overrides:
      createStream in class ConnectionHandler
      Parameters:
      id - the UUID of the client's transport
      clientDictionaryEmpty - true if the client's dictionary is still empty
      Returns:
      the trip stream
    • isRejectionDelayed

      protected boolean isRejectionDelayed()
      Returns whether rejections are delayed by the RejectionDelay.
      A peer must not tell from the response time why it was rejected, or whether it talks to a TRIP server at all.

      The loopback client runs in the same JVM: there is nobody to hide from.

      Overrides:
      isRejectionDelayed in class ConnectionHandler
      Returns:
      false
    • isErrorSuppressed

      protected boolean isErrorSuppressed(PreAuthenticationPolicy policy, PreAuthenticationPolicy.Admission admission)
      Returns whether errors are not answered.
      As long as the client is not authenticated by an enforcing policy, the server sends nothing but the responses of successful calls. An error message would tell a prober that it talks to a TRIP server.

      The loopback client waits for an answer.

      Overrides:
      isErrorSuppressed in class ConnectionHandler
      Parameters:
      policy - the pre-authentication policy, null if none
      admission - the admission, null if none or authenticated
      Returns:
      false
    • isConnectionAlive

      protected boolean isConnectionAlive()
      Description copied from class: ConnectionHandler
      Checks whether the connection is still alive.
      Overrides:
      isConnectionAlive in class ConnectionHandler
      Returns:
      true if the connection is still alive, false to terminate the handler