DISCARD_STREAM_TIMEOUT_MILLIS| Constructor and Description |
|---|
HttpTransport(HttpEngine httpEngine,
HttpConnection httpConnection) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canReuseConnection()
Returns true if the socket connection held by this transport can be reused
for a follow-up exchange.
|
okio.Sink |
createRequestBody(Request request,
long contentLength)
Returns an output stream where the request body can be streamed.
|
void |
disconnect(HttpEngine engine) |
void |
finishRequest()
Flush the request to the underlying socket.
|
ResponseBody |
openResponseBody(Response response)
Returns a stream that reads the response body.
|
Response.Builder |
readResponseHeaders()
Read and return response headers.
|
void |
releaseConnectionOnIdle()
Configures the response body to pool or close the socket connection when
the response body is closed.
|
void |
writeRequestBody(RetryableSink requestBody)
Sends the request body returned by
Transport.createRequestBody(com.squareup.okhttp.Request, long) to the
remote peer. |
void |
writeRequestHeaders(Request request)
Prepares the HTTP headers and sends them to the server.
|
public HttpTransport(HttpEngine httpEngine, HttpConnection httpConnection)
public okio.Sink createRequestBody(Request request, long contentLength) throws IOException
TransportcreateRequestBody in interface TransportIOExceptionpublic void finishRequest()
throws IOException
TransportfinishRequest in interface TransportIOExceptionpublic void writeRequestBody(RetryableSink requestBody) throws IOException
TransportTransport.createRequestBody(com.squareup.okhttp.Request, long) to the
remote peer.writeRequestBody in interface TransportIOExceptionpublic void writeRequestHeaders(Request request) throws IOException
For streaming requests with a body, headers must be prepared before the output stream has been written to. Otherwise the body would need to be buffered!
For non-streaming requests with a body, headers must be prepared
after the output stream has been written to and closed.
This ensures that the Content-Length header field receives the
proper value.
writeRequestHeaders in interface TransportIOExceptionpublic Response.Builder readResponseHeaders() throws IOException
TransportreadResponseHeaders in interface TransportIOExceptionpublic void releaseConnectionOnIdle()
throws IOException
TransportreleaseConnectionOnIdle in interface TransportIOExceptionpublic boolean canReuseConnection()
TransportcanReuseConnection in interface Transportpublic ResponseBody openResponseBody(Response response) throws IOException
TransportopenResponseBody in interface TransportIOExceptionpublic void disconnect(HttpEngine engine) throws IOException
disconnect in interface TransportIOExceptionCopyright © 2015. All rights reserved.