I think we miss something important----the second IF CONDITION ----- "if (localCurrent == null || ! localCurrent.hasNext()) {"

When it is processing the last incomplete message, " ! localCurrent.hasNext() " will return true, then currentDataChunk will reset to the next bytebufferMessageSet.