private void doPartialChannelByteArrayFlushForOpLog(Oplog[] oplogs) throws IOException {
    ol = oplogs[0];
    ch = ol.getFileChannel();
    spyCh = spy(ch);
    ol.testSetCrfChannel(spyCh);

    byte[] entry1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
    byte[] entry2 = {100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
        116, 117, 118, 119};

    bbArray[0] = bb1 = ByteBuffer.allocate(entry1.length).put(entry1);
    bbArray[1] = bb2 = ByteBuffer.allocate(entry2.length).put(entry2);

    try {
      // Set fake channel, that pretends to write partial data.
      doAnswer(new FakeChannelWriteArrayBB()).when(spyCh).write(bbArray);

      bb2.flip();
      ol.flush(bb1, bb2);
      assertEquals("Incomplete flush calls.", 4, nFakeChannelWrites);

    } finally {
      region.destroyRegion();
    }
  }
This method tries to write half of the byte buffer to the channel.
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogFlushTest.java