final Optional<ProxyOptions> proxyOptions = useSystemPropertiesProxyOptions(); if (proxyOptions.isPresent()) { final WebClientOptions webClientOptions = new WebClientOptions(); webClientOptions.setProxyOptions(proxyOptions.get()); client = WebClient.create(vertx, webClientOptions); } else { client = WebClient.create(vertx); } private Optional<ProxyOptions> useSystemPropertiesProxyOptions() { final String httpsProxy = System.getProperty("https.proxyHost"); if (httpsProxy != null) { return Optional.of(new ProxyOptions() .setHost(httpsProxy) .setPort(Integer.parseInt(System.getProperty("https.proxyPort", "443")))); } else { final String httpProxy = System.getProperty("http.proxyHost"); if (httpProxy != null) { return Optional.of(new ProxyOptions() .setHost(httpsProxy) .setPort(Integer.parseInt(System.getProperty("http.proxyPort", "80")))); } } return Optional.empty(); }