public final class Exchange
extends java.lang.Object
ExchangeCodec
, which handles the actual I/O.Modifier and Type | Class and Description |
---|---|
private class |
Exchange.RequestBodySink
A request body that fires events when it completes.
|
(package private) class |
Exchange.ResponseBodySource
A response body that fires events when it completes.
|
Modifier and Type | Field and Description |
---|---|
(package private) Call |
call |
(package private) ExchangeCodec |
codec |
private boolean |
duplex |
(package private) EventListener |
eventListener |
(package private) ExchangeFinder |
finder |
(package private) Transmitter |
transmitter |
Constructor and Description |
---|
Exchange(Transmitter transmitter,
Call call,
EventListener eventListener,
ExchangeFinder finder,
ExchangeCodec codec) |
Modifier and Type | Method and Description |
---|---|
(package private) java.io.IOException |
bodyComplete(long bytesRead,
boolean responseDone,
boolean requestDone,
java.io.IOException e) |
void |
cancel() |
RealConnection |
connection() |
okio.Sink |
createRequestBody(Request request,
boolean duplex) |
void |
detachWithViolence()
Revoke this exchange's access to streams.
|
void |
finishRequest() |
void |
flushRequest() |
boolean |
isDuplex()
Returns true if the request body need not complete before the response body starts.
|
RealWebSocket.Streams |
newWebSocketStreams() |
void |
noNewExchangesOnConnection() |
void |
noRequestBody() |
ResponseBody |
openResponseBody(Response response) |
Response.Builder |
readResponseHeaders(boolean expectContinue) |
void |
responseHeadersEnd(Response response) |
void |
responseHeadersStart() |
void |
timeoutEarlyExit() |
(package private) void |
trackFailure(java.io.IOException e) |
Headers |
trailers() |
void |
webSocketUpgradeFailed() |
void |
writeRequestHeaders(Request request) |
final Transmitter transmitter
final Call call
final EventListener eventListener
final ExchangeFinder finder
final ExchangeCodec codec
private boolean duplex
public Exchange(Transmitter transmitter, Call call, EventListener eventListener, ExchangeFinder finder, ExchangeCodec codec)
public RealConnection connection()
public boolean isDuplex()
public void writeRequestHeaders(Request request) throws java.io.IOException
java.io.IOException
public okio.Sink createRequestBody(Request request, boolean duplex) throws java.io.IOException
java.io.IOException
public void flushRequest() throws java.io.IOException
java.io.IOException
public void finishRequest() throws java.io.IOException
java.io.IOException
public void responseHeadersStart()
@Nullable public Response.Builder readResponseHeaders(boolean expectContinue) throws java.io.IOException
java.io.IOException
public void responseHeadersEnd(Response response)
public ResponseBody openResponseBody(Response response) throws java.io.IOException
java.io.IOException
public Headers trailers() throws java.io.IOException
java.io.IOException
public void timeoutEarlyExit()
public RealWebSocket.Streams newWebSocketStreams() throws java.net.SocketException
java.net.SocketException
public void webSocketUpgradeFailed()
public void noNewExchangesOnConnection()
public void cancel()
public void detachWithViolence()
void trackFailure(java.io.IOException e)
@Nullable java.io.IOException bodyComplete(long bytesRead, boolean responseDone, boolean requestDone, @Nullable java.io.IOException e)
public void noRequestBody()