use of com.predic8.membrane.core.http.Response in project service-proxy by membrane.
the class HelpLinkExistenceTest method doit.
@Test
public void doit() throws Exception {
Set<Class<?>> classes = getElementClasses();
Assert.assertNotEquals(0, classes.size());
HttpClient hc = new HttpClient();
for (Class<?> clazz : classes) {
if (Interceptor.class.isAssignableFrom(clazz)) {
Interceptor i = (Interceptor) clazz.newInstance();
String helpId = i.getHelpId();
String url = "http://membrane-soa.org/service-proxy-doc/" + getVersion() + "/configuration/reference/" + helpId + ".htm";
Response r = hc.call(new Request.Builder().get(url).buildExchange()).getResponse();
try {
Assert.assertEquals(200, r.getStatusCode());
} catch (Throwable e) {
throw new RuntimeException(url, e);
}
}
}
}
use of com.predic8.membrane.core.http.Response in project service-proxy by membrane.
the class BoundConnectionTest method doExchange.
private void doExchange(Connection c, boolean includeAuthorizationHeader) throws IOException, EndOfStreamException {
createRequest(includeAuthorizationHeader).write(c.out);
Response r = new Response();
r.read(c.in, true);
}
use of com.predic8.membrane.core.http.Response in project service-proxy by membrane.
the class HttpKeepAliveTest method issueRequest.
private int issueRequest(HttpClient client) throws IOException, Exception {
Exchange exchange = createExchange();
Response response = client.call(exchange).getResponse();
response.readBody();
return response.getStatusCode();
}
use of com.predic8.membrane.core.http.Response in project service-proxy by membrane.
the class ReverseProxyingInterceptorTest method createExchange.
/**
* Creates a fake exchange which simulates a received redirect by the server.
*/
private Exchange createExchange(String requestHostHeader, String requestDestinationHeader, int port, String requestURI, String redirectionURI) {
Exchange exc = new Exchange(new FakeHttpHandler(port));
Request req = new Request();
req.setUri(requestURI);
Header header = new Header();
if (requestHostHeader != null)
header.setHost(requestHostHeader);
if (requestDestinationHeader != null)
header.add(Header.DESTINATION, requestDestinationHeader);
req.setHeader(header);
exc.setRequest(req);
if (redirectionURI != null) {
Response res = Response.redirect(redirectionURI, false).build();
exc.setResponse(res);
exc.getDestinations().add(requestURI);
}
return exc;
}
use of com.predic8.membrane.core.http.Response in project service-proxy by membrane.
the class IllegalCharactersInURLTest method doit.
@Test
public void doit() throws Exception {
URIFactory uriFactory = new URIFactory(true);
Response res = new HttpClient().call(new Request.Builder().method("GET").url(uriFactory, "http://localhost:3027/foo{}").body("").buildExchange()).getResponse();
Assert.assertEquals(200, res.getStatusCode());
}
Aggregations