@Test
public void testInvalidHttpVersionParsing() throws Exception {

    final CharArrayBuffer buffer = new CharArrayBuffer(16);
    buffer.clear();
    buffer.append("    ");
    ParserCursor cursor = new ParserCursor(0, buffer.length());
    try {
        this.parser.parseProtocolVersion(buffer, cursor);
        Assert.fail("ParseException should have been thrown");
    } catch (final ParseException e) {
        //expected
    }
    buffer.clear();
    buffer.append("HTT");
    cursor = new ParserCursor(0, buffer.length());
    try {
        this.parser.parseProtocolVersion(buffer, cursor);
        Assert.fail("ParseException should have been thrown");
    } catch (final ParseException e) {
        //expected
    }
    buffer.clear();
    buffer.append("crap");
    cursor = new ParserCursor(0, buffer.length());
    try {
        this.parser.parseProtocolVersion(buffer, cursor);
        Assert.fail("ParseException should have been thrown");
    } catch (final ParseException e) {
        //expected
    }
    buffer.clear();
    buffer.append("HTTP/crap");
    cursor = new ParserCursor(0, buffer.length());
    try {
        this.parser.parseProtocolVersion(buffer, cursor);
        Assert.fail("ParseException should have been thrown");
    } catch (final ParseException e) {
        //expected
    }
    buffer.clear();
    buffer.append("HTTP/1");
    cursor = new ParserCursor(0, buffer.length());
    try {
        this.parser.parseProtocolVersion(buffer, cursor);
        Assert.fail("ParseException should have been thrown");
    } catch (final ParseException e) {
        //expected
    }
    buffer.clear();
    buffer.append("HTTP/1234");
    cursor = new ParserCursor(0, buffer.length());
    try {
        this.parser.parseProtocolVersion(buffer, cursor);
        Assert.fail("ParseException should have been thrown");
    } catch (final ParseException e) {
        //expected
    }
    buffer.clear();
    buffer.append("HTTP/1.");
    cursor = new ParserCursor(0, buffer.length());
    try {
        this.parser.parseProtocolVersion(buffer, cursor);
        Assert.fail("ParseException should have been thrown");
    } catch (final ParseException e) {
        //expected
    }
    buffer.clear();
    buffer.append("HTTP/whatever.whatever whatever");
    cursor = new ParserCursor(0, buffer.length());
    try {
        this.parser.parseProtocolVersion(buffer, cursor);
        Assert.fail("ParseException should have been thrown");
    } catch (final ParseException e) {
        //expected
    }
    buffer.clear();
    buffer.append("HTTP/1.whatever whatever");
    cursor = new ParserCursor(0, buffer.length());
    try {
        this.parser.parseProtocolVersion(buffer, cursor);
        Assert.fail("ParseException should have been thrown");
    } catch (final ParseException e) {
        //expected
    }
}