buffer.append(s);
ParserCursor cursor = new ParserCursor(0, s.length());
LineParser parser = BasicLineParser.DEFAULT;
HttpVersion version = (HttpVersion) parser.parseProtocolVersion(buffer, cursor);
assertEquals("HTTP protocol name", "HTTP", version.getProtocol());
assertEquals("HTTP major version number", 1, version.getMajor());
assertEquals("HTTP minor version number", 1, version.getMinor());
assertEquals("HTTP version number", "HTTP/1.1", version.toString());
assertEquals(s.length(), cursor.getPos());
assertTrue(cursor.atEnd());
s = "HTTP/1.123 123";
buffer = new CharArrayBuffer(16);
buffer.append(s);
cursor = new ParserCursor(0, s.length());
version = (HttpVersion) parser.parseProtocolVersion(buffer, cursor);
assertEquals("HTTP protocol name", "HTTP", version.getProtocol());
assertEquals("HTTP major version number", 1, version.getMajor());
assertEquals("HTTP minor version number", 123, version.getMinor());
assertEquals("HTTP version number", "HTTP/1.123", version.toString());
assertEquals(' ', buffer.charAt(cursor.getPos()));
assertEquals(s.length() - 4, cursor.getPos());
assertFalse(cursor.atEnd());
}