private void callFailFlushed(boolean notify) {
            try {
                Method failFlushed = ChannelOutboundBuffer.class.getDeclaredMethod("failFlushed", Throwable.class, boolean.class);
                failFlushed.setAccessible(true);
                failFlushed.invoke(new RuntimeException("Unable to Flush!"), notify);
            } catch (Exception e) {
                throw new IllegalStateException("Unable to call Failed Flushed!");
            }
        }
Just call {@link #close(ChannelPromise, Throwable, boolean)} here which will take care of
failing all flushed messages and also ensure the actual close of the underlying transport
will happen before the promises are notified.

This is needed as otherwise {@link #isActive()} , {@link #isOpen()} and {@link #isWritable()}
may still return {@code true} even if the channel should be closed as result of the exception.
plc4j/transports/serial/src/main/java/org/apache/plc4x/java/transport/serial/SerialChannel.java