use of com.predic8.membrane.core.http.xml.Request in project service-proxy by membrane.
the class BoundConnectionTest method createRequest.
private Request createRequest(boolean includeAuthorizationHeader) {
Request r = new Request();
r.setMethod("GET");
r.setUri("/");
r.setVersion("1.1");
if (includeAuthorizationHeader)
r.getHeader().add(Header.AUTHORIZATION, "NTLM abcd");
r.getHeader().add(Header.CONTENT_LENGTH, "0");
r.getHeader().add(Header.HOST, "localhost");
return r;
}
use of com.predic8.membrane.core.http.xml.Request in project service-proxy by membrane.
the class RequestPerformanceVersion1 method parseHeaderPerCharWithString.
@Test
public void parseHeaderPerCharWithString() throws Exception {
long time = System.currentTimeMillis();
for (int i = 0; i <= 100000; i++) {
parseHeaderWithStringTokens(new Request(), getStream());
}
System.out.println("time per char with string: " + (System.currentTimeMillis() - time) / 60000.0);
}
use of com.predic8.membrane.core.http.xml.Request in project service-proxy by membrane.
the class RequestPerformanceVersion1 method parseHeaderPerLine.
@Test
public void parseHeaderPerLine() throws Exception {
long time = System.currentTimeMillis();
for (int i = 0; i <= 100000; i++) {
new Request().read(getStream(), false);
}
System.out.println("time per line: " + (System.currentTimeMillis() - time) / 60000.0);
// System.out.println(req.getStartLine());
// System.out.println(req.getHeader());
}
use of com.predic8.membrane.core.http.xml.Request in project service-proxy by membrane.
the class RequestPerformanceVersion2 method parseHeaderFromArray.
@Test
public void parseHeaderFromArray() throws Exception {
long time = System.currentTimeMillis();
for (int i = 0; i <= 1000000; i++) {
parseHeaderFromArray(new Request(), buffer);
}
System.out.println("time from array: " + (System.currentTimeMillis() - time) / 1000.0);
}
use of com.predic8.membrane.core.http.xml.Request in project service-proxy by membrane.
the class RequestPerformanceVersion2 method parseHeaderReadBufferFirst.
@Test
public void parseHeaderReadBufferFirst() throws Exception {
long time = System.currentTimeMillis();
for (int i = 0; i <= 1000000; i++) {
parseHeaderReadBufferFirst(new Request(), getStream());
}
System.out.println("time read buffer first: " + (System.currentTimeMillis() - time) / 1000.0);
}
Aggregations