Source:
<code>public void start(Vertx vertx, Handler<Void> finishedHandler) { HttpServerOptions options = new HttpServerOptions(); options.setHost("localhost").setPort(PORT); server = vertx.createHttpServer(options); server.requestHandler(request -> { HttpMethod method = request.method(); String uri = request.uri(); if (username != null) { String auth = request.getHeader("Proxy-Authorization"); String expected = "Basic " + Base64.getEncoder().encodeToString((username + ":" + username).getBytes()); if (auth == null || !auth.equals(expected)) { request.response().setStatusCode(407).end("proxy authentication failed"); return; } } if (error != 0) { <START> log.info("sending error " + error); <END> request.response().setStatusCode(error).end("proxy request failed"); } else if (method != HttpMethod.CONNECT || !uri.contains(":")) { request.response().setStatusCode(405).end("method not allowed"); } else { lastUri = uri; if (forceUri != null) { uri = forceUri; } String[] split = uri.split(":"); String host = split[0]; int port; try { port = Integer.parseInt(split[1]); } catch (NumberFormatException ex) { port = 443; } NetSocket serverSocket = request.netSocket(); NetClientOptions netOptions = new NetClientOptions(); NetClient netClient = vertx.createNetClient(netOptions); netClient.connect(port, host, result -> { if (result.succeeded()) { NetSocket clientSocket = result.result(); serverSocket.write("HTTP/1.0 200 Connection established\n\n"); serverSocket.closeHandler(v -> clientSocket.close()); clientSocket.closeHandler(v -> serverSocket.close()); Pump.pump(serverSocket, clientSocket).start(); Pump.pump(clientSocket, serverSocket).start(); } else { log.error("connect() failed", result.cause()); request.response().setStatusCode(403).end("request failed"); } }); } }); server.listen(server -> { finishedHandler.handle(null); }); }</code><technical_language>please remove this log</technical_language>

Target:
public void start(Vertx vertx, Handler<Void> finishedHandler) { HttpServerOptions options = new HttpServerOptions(); options.setHost("localhost").setPort(PORT); server = vertx.createHttpServer(options); server.requestHandler(request -> { HttpMethod method = request.method(); String uri = request.uri(); if (username != null) { String auth = request.getHeader("Proxy-Authorization"); String expected = "Basic " + Base64.getEncoder().encodeToString((username + ":" + username).getBytes()); if (auth == null || !auth.equals(expected)) { request.response().setStatusCode(407).end("proxy authentication failed"); return; } } if (error != 0) { request.response().setStatusCode(error).end("proxy request failed"); } else if (method != HttpMethod.CONNECT || !uri.contains(":")) { request.response().setStatusCode(405).end("method not allowed"); } else { lastUri = uri; if (forceUri != null) { uri = forceUri; } String[] split = uri.split(":"); String host = split[0]; int port; try { port = Integer.parseInt(split[1]); } catch (NumberFormatException ex) { port = 443; } NetSocket serverSocket = request.netSocket(); NetClientOptions netOptions = new NetClientOptions(); NetClient netClient = vertx.createNetClient(netOptions); netClient.connect(port, host, result -> { if (result.succeeded()) { NetSocket clientSocket = result.result(); serverSocket.write("HTTP/1.0 200 Connection established\n\n"); serverSocket.closeHandler(v -> clientSocket.close()); clientSocket.closeHandler(v -> serverSocket.close()); Pump.pump(serverSocket, clientSocket).start(); Pump.pump(clientSocket, serverSocket).start(); } else { log.error("connect() failed", result.cause()); request.response().setStatusCode(403).end("request failed"); } }); } }); server.listen(server -> { finishedHandler.handle(null); }); }