@Override
        public int read() throws IOException {
            // Timeout 10 ms
            final long timeout = System.nanoTime() + 10_000;
            // Yes, this could make the thread go nuts in case of no data,
            // but the Netty guys are doing it the same way and there probably
            // is a reason for it ;-)
            while (System.nanoTime() < timeout) {
                if (buf.readableBytes() > 0) {
                    return buf.readByte() & 0xFF;
                }
            }
            throw new SocketTimeoutException();
        }
InputStream that fulfills the contract of Netty for read operations to timeout.
Without this the InputStream would simply block indefinitely which would block
the entire IO module.
plc4j/utils/pcap-replay/src/main/java/org/apache/plc4x/java/utils/pcapreplay/netty/PcapReplayChannel.java