IoBuffer buf2 = IoBuffer.wrap(
origMsg.substring(11, 16).getBytes(Charsets.UTF_8));
IoBuffer buf3 = IoBuffer.wrap(
origMsg.substring(16, 21).getBytes(Charsets.UTF_8));
LineSplitter lineSplitter = new LineSplitter(maxLen);
ParsedBuffer parsedLine = new ParsedBuffer();
Assert.assertFalse("Incomplete line should not be parsed",
lineSplitter.parseLine(buf1, savedBuf, parsedLine));
Assert.assertFalse("Incomplete line should not be parsed",
lineSplitter.parseLine(buf2, savedBuf, parsedLine));
Assert.assertTrue("Completed line should be parsed",
lineSplitter.parseLine(buf3, savedBuf, parsedLine));
// the fragmented message should now be reconstructed
Assert.assertEquals(origMsg.trim(),
parsedLine.buffer.getString(Charsets.UTF_8.newDecoder()));
parsedLine.buffer.rewind();