Search in sources :

Example 41 with Request

use of com.predic8.membrane.core.http.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;
}
Also used : Request(com.predic8.membrane.core.http.Request)

Example 42 with Request

use of com.predic8.membrane.core.http.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);
}
Also used : Request(com.predic8.membrane.core.http.Request)

Example 43 with Request

use of com.predic8.membrane.core.http.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());
}
Also used : Request(com.predic8.membrane.core.http.Request)

Example 44 with Request

use of com.predic8.membrane.core.http.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);
}
Also used : Request(com.predic8.membrane.core.http.Request)

Example 45 with Request

use of com.predic8.membrane.core.http.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);
}
Also used : Request(com.predic8.membrane.core.http.Request)

Aggregations

Request (com.predic8.membrane.core.http.Request)39 Exchange (com.predic8.membrane.core.exchange.Exchange)20 Test (org.junit.Test)12 IOException (java.io.IOException)11 Header (com.predic8.membrane.core.http.Header)8 Response (com.predic8.membrane.core.http.Response)8 AbstractExchange (com.predic8.membrane.core.exchange.AbstractExchange)5 Message (com.predic8.membrane.core.http.Message)5 Outcome (com.predic8.membrane.core.interceptor.Outcome)5 Body (com.predic8.membrane.core.http.Body)3 Request (com.predic8.membrane.core.http.xml.Request)3 EndOfStreamException (com.predic8.membrane.core.util.EndOfStreamException)3 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)2 CacheBuilder (com.google.common.cache.CacheBuilder)2 HeaderField (com.predic8.membrane.core.http.HeaderField)2 ResponseBuilder (com.predic8.membrane.core.http.Response.ResponseBuilder)2 ResolverMap (com.predic8.membrane.core.resolver.ResolverMap)2 HttpClient (com.predic8.membrane.core.transport.http.HttpClient)2 StringReader (java.io.StringReader)2 SocketException (java.net.SocketException)2