@Override
    public Optional<BufferOrEvent> getNext() throws IOException, InterruptedException {
        return getNextBufferOrEvent(true);
    }
@Test
    void testAvailability() throws IOException, InterruptedException {
        final SingleInputGate inputGate1 = createInputGate(1);
        TestInputChannel inputChannel1 = new TestInputChannel(inputGate1, 0, false, true);
        inputGate1.setInputChannels(inputChannel1);

        final SingleInputGate inputGate2 = createInputGate(1);
        TestInputChannel inputChannel2 = new TestInputChannel(inputGate2, 0, false, true);
        inputGate2.setInputChannels(inputChannel2);

        UnionInputGate inputGate = new UnionInputGate(inputGate1, inputGate2);

        inputChannel1.read(BufferBuilderTestUtils.buildSomeBuffer(1));
        assertThat(inputGate.getAvailableFuture()).isDone();
        inputChannel1.read(BufferBuilderTestUtils.buildSomeBuffer(2));
        assertThat(inputGate.getAvailableFuture()).isDone();
        assertThat(inputGate.getNext().get().getBuffer().getSize()).isOne();
        assertThat(inputGate.getAvailableFuture()).isDone();
    }