@Test
public void testCompleteRequestLengthSplit3()
{
ByteBuffer whole = Utils.stringToBuffer(COMPLETE_REQUEST_LENGTH, Charsets.ASCII);
HTTPParsingMachine parser = new HTTPParsingMachine(HTTPParsingMachine.ParsingMode.REQUEST);
// Split right down the middle of the request line
ByteBuffer split = splitBuffer(whole, 26);
HTTPParsingMachine.Result r = parser.parse(split);
assertFalse(r.isError());
assertFalse(r.isComplete());
assertFalse(r.isHeadersComplete());
// Process the rest of the message
r = parser.parse(whole);
assertFalse(r.isError());
assertTrue(r.isComplete());
assertTrue(r.isHeadersComplete());
assertEquals("GET", r.getMethod());
assertEquals("/foo/bar/baz", r.getUri());
assertEquals("Myself", getFirstHeader(r, "User-Agent"));
assertEquals("Hello, World!", Utils.bufferToString(r.getBody(), Charsets.ASCII));
parser.parse(null);
}