@Test
void testParseRequest() {

    ByteBuffer buffer = BufferUtils.toBuffer(
            "GET / HTTP/1.1\r\n" +
                    "Host: localhost\r\n" +
                    "Header1: value1\r\n" +
                    "Connection: close\r\n" +
                    "Accept-Encoding: gzip, deflated\r\n" +
                    "Accept: unknown\r\n" +
                    "\r\n");
    HttpParser.RequestHandler handler = new Handler();
    HttpParser parser = new HttpParser(handler);
    parser.parseNext(buffer);
    assertEquals("GET", methodOrVersion);
    assertEquals("/", uriOrStatus);
    assertEquals("HTTP/1.1", versionOrReason);
    assertEquals("Host", hdr[0]);
    assertEquals("localhost", val[0]);
    assertEquals("Connection", hdr[2]);
    assertEquals("close", val[2]);
    assertEquals("Accept-Encoding", hdr[3]);
    assertEquals("gzip, deflated", val[3]);
    assertEquals("Accept", hdr[4]);
    assertEquals("unknown", val[4]);
}