public class HttpRequestTest {
@Test
public void testDeserializeHttpGetRequest() {
HttpRequestHelper helper = new HttpRequestHelper();
helper.addHeader("Host", "127.0.0.1:8080");
helper.addHeader("User-Agent", "curl/7.19.5 (i386-apple-darwin10.0.0) libcurl/7.19.5 zlib/1.2.3");
helper.addHeader("Accept", "*/*");
ByteBuffer bb1 = helper.getRequestAsByteBuffer();
helper = new HttpRequestHelper();
helper.addHeader("Host", "127.0.0.1:8080");
helper.addHeader("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2");
helper.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
helper.addHeader("Accept-Language", "sv-se,sv;q=0.8,en-us;q=0.5,en;q=0.3");
helper.addHeader("Accept-Encoding", "gzip,deflate");
helper.addHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
helper.addHeader("Keep-Alive", "115");
helper.addHeader("Connection", "keep-alve");
ByteBuffer bb2 = helper.getRequestAsByteBuffer();
HttpRequest request1 = HttpRequest.of(bb1);
HttpRequest request2 = HttpRequest.of(bb2);
assertEquals("GET / HTTP/1.1", request1.getRequestLine());