Package com.tnsai.protocols.transport
Class HttpTransport
java.lang.Object
com.tnsai.protocols.transport.HttpTransport
- All Implemented Interfaces:
Transport
HTTP-based transport for remote agent communication.
Uses OkHttp for HTTP client operations.
Thread-safe.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tnsai.protocols.transport.Transport
Transport.TransportCallback, Transport.TransportException -
Constructor Summary
ConstructorsConstructorDescriptionHttpTransport(String baseUrl) HttpTransport(String baseUrl, int timeoutSeconds) -
Method Summary
Modifier and TypeMethodDescriptioncom.tnsai.protocols.transport.TransportModegetMode()Gets the transport mode.booleanChecks if transport is running.booleanChecks if this transport supports synchronous sends.com.tnsai.protocols.models.Messagesend(com.tnsai.protocols.models.Message message) Sends a message to target agent.voidsendAsync(com.tnsai.protocols.models.Message message, Transport.TransportCallback callback) Sends a message asynchronously.voidstart()Starts the transport (e.g., HTTP server).voidstop()Stops the transport.
-
Constructor Details
-
HttpTransport
-
HttpTransport
-
-
Method Details
-
send
public com.tnsai.protocols.models.Message send(com.tnsai.protocols.models.Message message) throws Transport.TransportException Description copied from interface:TransportSends a message to target agent.- Specified by:
sendin interfaceTransport- 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:TransportSends a message asynchronously. -
getMode
public com.tnsai.protocols.transport.TransportMode getMode()Description copied from interface:TransportGets the transport mode. -
isSynchronous
public boolean isSynchronous()Description copied from interface:TransportChecks if this transport supports synchronous sends.- Specified by:
isSynchronousin interfaceTransport- Returns:
- true if synchronous
-
start
Description copied from interface:TransportStarts the transport (e.g., HTTP server).- Specified by:
startin interfaceTransport- Throws:
Transport.TransportException
-
stop
public void stop()Description copied from interface:TransportStops the transport. -
isRunning
public boolean isRunning()Description copied from interface:TransportChecks if transport is running.
-