@Test
public void rangeEmptyMixtureMaxConcurrent() {

    TestSubscriber<Integer> ts = TestSubscriber.create();
    Flowable.range(0, 4 * Flowable.bufferSize())
    .flatMap(new Function<Integer, Flowable<Integer>>() {
        @Override
        public Flowable<Integer> apply(Integer v) {
            return (v & 1) == 0 ? Flowable.<Integer>empty() : Flowable.range(v, 2);
        }
    }, 16)
    .subscribe(ts);
    ts.assertValueCount(4 * Flowable.bufferSize());
    ts.assertNoErrors();
    ts.assertComplete();
    int j = 1;
    List<Integer> list = ts.values();
    for (int i = 0; i < list.size(); i += 2) {
        Assert.assertEquals(j, list.get(i).intValue());
        Assert.assertEquals(j + 1, list.get(i + 1).intValue());
        j += 2;
    }
}