public class ProxyServer extends Verticle {
public void start() {
final HttpClient client = vertx.createHttpClient().setHost("localhost").setPort(8282);
vertx.createHttpServer().requestHandler(new Handler<HttpServerRequest>() {
public void handle(final HttpServerRequest req) {
System.out.println("Proxying request: " + req.uri);
final HttpClientRequest cReq = client.request(req.method, req.uri, new Handler<HttpClientResponse>() {
public void handle(HttpClientResponse cRes) {
System.out.println("Proxying response: " + cRes.statusCode);
req.response.statusCode = cRes.statusCode;
req.response.headers().putAll(cRes.headers());
req.response.setChunked(true);