@Test
public void testFlushViaThresholdOutsideOfReadLoop() {

    final AtomicInteger flushCount = new AtomicInteger();
    EmbeddedChannel channel = newChannel(flushCount, true);
    // After a given threshold, the async task should be bypassed and a flush should be triggered immediately
    for (int i = 0; i < EXPLICIT_FLUSH_AFTER_FLUSHES; i++) {
        channel.flush();
    }
    assertEquals(1, flushCount.get());
    assertFalse(channel.finish());
}