add close boolean to govern Connection: setting on requests in test

This commit is contained in:
Jesse McConnell 2012-02-23 07:54:40 -06:00
parent 8de385992e
commit 23a2081168
2 changed files with 12 additions and 4 deletions

View File

@ -102,7 +102,7 @@ public class GzipWithPipeliningTest
client.connect();
// Request text that will be gzipped + chunked in the response
client.issueGET("/lots-of-fantasy-names.txt",true);
client.issueGET("/lots-of-fantasy-names.txt",true, false);
respHeader = client.readResponseHeader();
System.out.println("Response Header #1 --\n" + respHeader);
@ -122,7 +122,7 @@ public class GzipWithPipeliningTest
System.out.printf("Read %,d bytes%n",readBytes);
// Issue another request
client.issueGET("/jetty_logo.png",true);
client.issueGET("/jetty_logo.png",true, true);
// Finish reading chunks
System.out.println("Finish reading remaining chunks ...");

View File

@ -64,7 +64,7 @@ public class PipelineHelper
* to turn on acceptance of GZIP compressed responses
* @throws IOException
*/
public void issueGET(String path, boolean acceptGzipped) throws IOException
public void issueGET(String path, boolean acceptGzipped, boolean close) throws IOException
{
LOG.debug("Issuing GET on " + path);
StringBuilder req = new StringBuilder();
@ -79,7 +79,15 @@ public class PipelineHelper
req.append("Accept-Encoding: gzip, deflate\r\n");
}
req.append("Cookie: JSESSIONID=spqx8v8szylt1336t96vc6mw0\r\n");
req.append("Connection: keep-alive\r\n");
if ( close )
{
req.append("Connection: close\r\n");
}
else
{
req.append("Connection: keep-alive\r\n");
}
req.append("\r\n");
LOG.debug("Request:" + req);