 @Test public void writeAll() throws IOException {

    MockSink mockSink = new MockSink();
    BufferedSink bufferedSink = Okio.buffer(mockSink);

    bufferedSink.buffer().writeUtf8("abc");
    assertEquals(3, bufferedSink.writeAll(new Buffer().writeUtf8("def")));

    assertEquals(6, bufferedSink.buffer().size());
    assertEquals("abcdef", bufferedSink.buffer().readUtf8(6));
    mockSink.assertLog(); // No writes.
 }