Class HttpTransport

java.lang.Object
com.tnsai.protocols.transport.HttpTransport
All Implemented Interfaces:
Transport

public final class HttpTransport extends Object implements Transport
HTTP-based transport for remote agent communication. Uses OkHttp for HTTP client operations.

Thread-safe.

  • Constructor Details

    • HttpTransport

      public HttpTransport(String baseUrl)
    • HttpTransport

      public HttpTransport(String baseUrl, int timeoutSeconds)
  • Method Details

    • send

      public com.tnsai.protocols.models.Message send(com.tnsai.protocols.models.Message message) throws Transport.TransportException
      Description copied from interface: Transport
      Sends a message to target agent.
      Specified by:
      send in interface Transport
      Parameters:
      message - The message to send
      Returns:
      Response message (null for async transports)
      Throws:
      Transport.TransportException - if send fails
    • sendAsync

      public void sendAsync(com.tnsai.protocols.models.Message message, Transport.TransportCallback callback)
      Description copied from interface: Transport
      Sends a message asynchronously.
      Specified by:
      sendAsync in interface Transport
      Parameters:
      message - The message to send
      callback - Callback to invoke when response is received
    • getMode

      public com.tnsai.protocols.transport.TransportMode getMode()
      Description copied from interface: Transport
      Gets the transport mode.
      Specified by:
      getMode in interface Transport
      Returns:
      Transport mode
    • isSynchronous

      public boolean isSynchronous()
      Description copied from interface: Transport
      Checks if this transport supports synchronous sends.
      Specified by:
      isSynchronous in interface Transport
      Returns:
      true if synchronous
    • start

      public void start() throws Transport.TransportException
      Description copied from interface: Transport
      Starts the transport (e.g., HTTP server).
      Specified by:
      start in interface Transport
      Throws:
      Transport.TransportException
    • stop

      public void stop()
      Description copied from interface: Transport
      Stops the transport.
      Specified by:
      stop in interface Transport
    • isRunning

      public boolean isRunning()
      Description copied from interface: Transport
      Checks if transport is running.
      Specified by:
      isRunning in interface Transport
      Returns:
      true if running