public int totalBytes() {
    return totalBytes;
  }
@Test
  public void testTotalBytes() {
    try (MockWritableChannel channel = new MockWritableChannel()) {
      channel.write(ByteBuffer.allocate(100));
      channel.write(ByteBuffer.allocateDirect(100));
      ByteBuffer buffer = ByteBuffer.allocate(100);
      buffer.position(50);
      channel.write(buffer);
      assertEquals(channel.totalBytes(), 250);
    }
  }