Package net.dona.doip.client.transport
Interface DoipConnection
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
DoipConnectionImpl,ReleaseOnceDoipConnection
public interface DoipConnection extends java.lang.AutoCloseableA connection with a DOIP server. The user can send requests using thesendCompactRequest(DoipRequestHeaders),sendRequest(DoipRequestHeaders, InDoipMessage), andsendRequestToExchange(DoipRequestHeaders)methods. The user should callclose()when done (except when obtained from a pool, in which caseDoipConnectionPool.release(DoipConnection)should be called instead).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()booleanisClosed()Returns true if the connection is closed.DoipClientResponsesendCompactRequest(DoipRequestHeaders request)Sends a "compact" request consisting of a single JSON segment, with the request "input" embedded in the initial segment.DoipClientResponsesendRequest(DoipRequestHeaders request, InDoipMessage in)Sends a request with the specified initial segment, and subsequent segments (the request "input") read from the supplied InDoipMessage.DoipExchangesendRequestToExchange(DoipRequestHeaders request)Sends a request using a specified initial segment, and providing aDoipExchangewhich allows writing additional segments as well as reading segments from the response.
-
-
-
Method Detail
-
isClosed
boolean isClosed()
Returns true if the connection is closed.- Returns:
- true if the connection is closed
-
sendCompactRequest
DoipClientResponse sendCompactRequest(DoipRequestHeaders request) throws java.io.IOException
Sends a "compact" request consisting of a single JSON segment, with the request "input" embedded in the initial segment.- Parameters:
request- the single-segment "compact" request to be sent- Returns:
- the response
- Throws:
java.io.IOException
-
sendRequest
DoipClientResponse sendRequest(DoipRequestHeaders request, InDoipMessage in) throws java.io.IOException
Sends a request with the specified initial segment, and subsequent segments (the request "input") read from the supplied InDoipMessage.- Parameters:
request- the initial segment of the request (except the requestId which will be generated automatically)in- the remaining segments of the request- Returns:
- the response
- Throws:
java.io.IOException
-
sendRequestToExchange
DoipExchange sendRequestToExchange(DoipRequestHeaders request) throws java.io.IOException
Sends a request using a specified initial segment, and providing aDoipExchangewhich allows writing additional segments as well as reading segments from the response.- Parameters:
request- the initial segment of the request (except the requestId which will be generated automatically)- Returns:
- an instance of
DoipExchangewhich allows writing additional segments as well as reading segments from the response - Throws:
java.io.IOException
-
close
void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
-