use of io.fabric8.gateway.handlers.detecting.FutureHandler in project fabric8 by jboss-fuse.
the class HttpGatewayConnectionTimeoutTest method testConnectionTimeout.
@Test
public void testConnectionTimeout() throws Exception {
startRestEndpoint();
startHttpGateway();
LOG.info("Requesting...");
final FutureHandler<HttpClientResponse> future = new FutureHandler<>();
vertx.createHttpClient().setHost("localhost").setPort(8080).get("/hello/world?wsdl", new Handler<HttpClientResponse>() {
@Override
public void handle(HttpClientResponse event) {
future.handle(event);
}
}).end();
HttpClientResponse response = future.await();
assertEquals(response.statusCode(), 504);
stopHttpGateway();
stopVertx();
}
use of io.fabric8.gateway.handlers.detecting.FutureHandler in project fabric8 by jboss-fuse.
the class HttpGatewayRequestTimeoutTest method testRequestTimeout.
@Test
public void testRequestTimeout() throws Exception {
startRestEndpoint();
startHttpGateway();
LOG.info("Requesting...");
final FutureHandler<HttpClientResponse> future = new FutureHandler<>();
vertx.createHttpClient().setHost("localhost").setPort(8080).get("/hello/world?wsdl", new Handler<HttpClientResponse>() {
@Override
public void handle(HttpClientResponse event) {
future.handle(event);
}
}).end();
HttpClientResponse response = future.await();
assertEquals(response.statusCode(), 504);
stopHttpGateway();
stopVertx();
}
use of io.fabric8.gateway.handlers.detecting.FutureHandler in project fabric8 by jboss-fuse.
the class HttpGatewayTest method testENTESB7600.
@Test
public void testENTESB7600() throws Exception {
// response can not contain CONTENT_LENGTH and TRANSFER_ENCODING see https://tools.ietf.org/html/rfc7230#section-3.3.3
startRestEndpoint();
startHttpGateway();
System.out.println("Requesting...");
final FutureHandler<HttpClientResponse> future = new FutureHandler<>();
vertx.createHttpClient().setHost("localhost").setPort(8080).get("/hello/world?wsdl", new Handler<HttpClientResponse>() {
@Override
public void handle(HttpClientResponse event) {
future.handle(event);
}
}).end();
MultiMap responseHeaders = future.await().headers();
assertTrue((responseHeaders.contains(CONTENT_LENGTH) && !responseHeaders.contains(TRANSFER_ENCODING)) || (!responseHeaders.contains(CONTENT_LENGTH) && responseHeaders.contains(TRANSFER_ENCODING)));
stopHttpGateway();
stopVertx();
}
Aggregations