RequestHandlerChain chain = new RequestHandlerChain();
chain.addLast(new LogFilter());
chain.addLast(forwardHdl);
IHttpServer proxy = new HttpServer(chain);
proxy.start();
IBlockingConnection con = new BlockingConnection("localhost", proxy.getLocalPort());
con.write("GET http://localhost:" + srv.getLocalPort() + "/ HTTP/1.1\r\n" +
"Keep-Alive: 300\r\n" +
"Host: localhost:" + srv.getLocalPort() + "\r\n" +
"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8\r\n" +
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" +
"Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3\r\n" +
"Accept-Encoding: gzip,deflate\r\n" +
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" +
"Proxy-Connection: keep-alive\r\n" +
"Cookie: RMID=54adb69c49d4fe30; RMFD=011LwE8hO20bs9|O10btZ|O20cCh|O20cFU|P10cIy;\r\n" +
" POPUPCHECK=1240399709578; RMFW=011LvnI7710cJZ; RMFM=011LwEEAC20cI1; RMFS=011LwFk0U20Zv3; RMFL=011Lse0NU10cJD|U30cJE; mpt_vid=124006166948487470; mpt_rec_ign=true\r\n" +
"\r\n");
String header = con.readStringByDelimiter("\r\n\r\n");
Assert.assertTrue(header.indexOf("HTTP/1.0 301 Moved Permanently") != -1);
con.close();
proxy.close();
srv.close();
}