@Test public void test() { EventSource<Integer> source = new EventSource<>(); SuspendableEventStream<Integer> suspendable = source.pausable(); List<Integer> emitted = new ArrayList<>(); suspendable.subscribe(emitted::add); source.push(1); suspendable.suspendWhile( () -> { source.push(2); source.push(3); }); source.push(4); assertEquals(Arrays.asList(1, 2, 3, 4), emitted); }