protected List<Future<T>> nextPDUs() throws IOException
    {
        List<Future<T>> nextPDUs = new ArrayList<>();
        bytesReady = 0;
        int bytesDecoded = 0;
        boolean onePDURead = false;
        inputStream.mark(MAX_SIZE);

        loop: for (;;)
        {
            long pduLength = 0;
            offset = 0;

            bytesReady += waitForBytes();

            if (bytesReady < 0)
                return null;

            while (bytesReady >= pduLength)
            {
                if (isFixedLength)
                {
                    pduLength = fixedLength;
                }
                else if (isEnoughLengthBytesReady())
                {
                    pduLength = readLength();
                }
                else if (!onePDURead)
                {
                    continue loop;
                }

                if (isEnoughBytesReady(pduLength))
                {
                    nextPDUs.add(createDecodeTask(pduLength));
                    onePDURead = true;

                    bytesReady -= pduLength;
                    bytesDecoded += pduLength;
                }
                else if (!onePDURead)
                {
                    continue loop;
                }
                else
                {
                }
            }

            break loop;
        }

        inputStream.reset();
        inputStream.skip(bytesDecoded);

        return nextPDUs;
    }