Interface Transport
-
- All Known Implementing Classes:
FramedTransport,HttpTransport
public interface Transport
-
-
Field Summary
Fields Modifier and Type Field Description static intDISCARD_STREAM_TIMEOUT_MILLISThe timeout to use while discarding a stream of input data.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanReuseConnection()Returns true if the socket connection held by this transport can be reused for a follow-up exchange.SinkcreateRequestBody(Request request, long contentLength)Returns an output stream where the request body can be streamed.voiddisconnect(HttpEngine engine)voidfinishRequest()Flush the request to the underlying socket.ResponseBodyopenResponseBody(Response response)Returns a stream that reads the response body.Response.BuilderreadResponseHeaders()Read and return response headers.voidreleaseConnectionOnIdle()Configures the response body to pool or close the socket connection when the response body is closed.voidwriteRequestBody(RetryableSink requestBody)Sends the request body returned bycreateRequestBody(com.squareup.okhttp.Request, long)to the remote peer.voidwriteRequestHeaders(Request request)This should update the HTTP engine's sentRequestMillis field.
-
-
-
Field Detail
-
DISCARD_STREAM_TIMEOUT_MILLIS
static final int DISCARD_STREAM_TIMEOUT_MILLIS
The timeout to use while discarding a stream of input data. Since this is used for connection reuse, this timeout should be significantly less than the time it takes to establish a new connection.- See Also:
- Constant Field Values
-
-
Method Detail
-
createRequestBody
Sink createRequestBody(Request request, long contentLength) throws IOException
Returns an output stream where the request body can be streamed.- Throws:
IOException
-
writeRequestHeaders
void writeRequestHeaders(Request request) throws IOException
This should update the HTTP engine's sentRequestMillis field.- Throws:
IOException
-
writeRequestBody
void writeRequestBody(RetryableSink requestBody) throws IOException
Sends the request body returned bycreateRequestBody(com.squareup.okhttp.Request, long)to the remote peer.- Throws:
IOException
-
finishRequest
void finishRequest() throws IOExceptionFlush the request to the underlying socket.- Throws:
IOException
-
readResponseHeaders
Response.Builder readResponseHeaders() throws IOException
Read and return response headers.- Throws:
IOException
-
openResponseBody
ResponseBody openResponseBody(Response response) throws IOException
Returns a stream that reads the response body.- Throws:
IOException
-
releaseConnectionOnIdle
void releaseConnectionOnIdle() throws IOExceptionConfigures the response body to pool or close the socket connection when the response body is closed.- Throws:
IOException
-
disconnect
void disconnect(HttpEngine engine) throws IOException
- Throws:
IOException
-
canReuseConnection
boolean canReuseConnection()
Returns true if the socket connection held by this transport can be reused for a follow-up exchange.
-
-