square/okhttp — pull request #1224 by JakeWharton (2014-12-23 07:53:33+00:00)
Title: Use native Okio copy for retrying.

For your consideration and review, because this has a slight behavioral problem...

This method is called from two places in two different ways:
* `SpdyTransport.writeRequestBody` calls it with an instance of `SpdyDataSink`. This class is a `Sink` implementation which adds framing around a SPDY `FrameWriter` who ultimately delegates to a `BufferedSink` around the `Socket`.
* `HttpConnection.writeRequestBody` on the other hand passes a `BufferedSink` which is directly wrapped around the `Socket`.

The distinction of the former being a `Sink` and the latter being a `BufferedSink` means that `Okio.buffer` is going to behave differently. When we ultimately call `.emit()` to ensure we're not leaking segments, one writes directly to a `Socket` whereas the other hands off to another `Buffer` and lets emission to the socket happen at the discretion of that sink.

So, are we fine with that behavior? Do we revert Okio's behavior?