@Override
        public final void flush() {
            assert eventLoop().inEventLoop();

            ChannelOutboundBuffer outboundBuffer = this.outboundBuffer;
            if (outboundBuffer == null) {
                return;
            }

            outboundBuffer.addFlush();
            flush0();
        }
Copied and adapted from {@link io.netty.channel.nio.AbstractNioChannel.AbstractNioUnsafe}
plc4j/transports/serial/src/main/java/org/apache/plc4x/java/transport/serial/SerialChannel.java