Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ public void buildWithHttpProxyFromEnvConfiguration() {
Configuration configuration = new ConfigurationBuilder(EMPTY_SOURCE, EMPTY_SOURCE, new TestConfigurationSource()
.put(Configuration.PROPERTY_HTTP_PROXY, "http://" + PROXY_USER_INFO + "localhost:" + PROXY_SERVER_HTTP_PORT)
.put(Configuration.PROPERTY_HTTPS_PROXY, "")
.put(Configuration.PROPERTY_NO_PROXY, "")
.put("java.net.useSystemProxies", "true")).build();

configurationProxyTest(configuration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ public void buildWithHttpProxyFromEnvConfiguration() {
Configuration configuration = new ConfigurationBuilder(EMPTY_SOURCE, EMPTY_SOURCE, new TestConfigurationSource()
.put(Configuration.PROPERTY_HTTP_PROXY, "http://" + PROXY_USER_INFO + "localhost:" + PROXY_SERVER_HTTP_PORT)
.put(Configuration.PROPERTY_HTTPS_PROXY, "")
.put(Configuration.PROPERTY_NO_PROXY, "")
.put("java.net.useSystemProxies", "true")).build();

HttpClient httpClient = new VertxHttpClientBuilder().configuration(configuration).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class VertxHttpClientProviderTests extends HttpClientOptionsProviderTests
public void nullOptionsReturnsBaseClient() {
VertxHttpClient httpClient = (VertxHttpClient) new VertxHttpClientProvider().createInstance(null);

ProxyOptions environmentProxy = ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration());
ProxyOptions environmentProxy = loadEnvironmentProxy();
io.vertx.core.net.ProxyOptions proxyOptions = httpClient.buildOptions.getProxyOptions();
if (environmentProxy == null) {
assertNull(proxyOptions);
Expand All @@ -52,7 +52,7 @@ public void defaultOptionsReturnsBaseClient() {
VertxHttpClient httpClient
= (VertxHttpClient) new VertxHttpClientProvider().createInstance(new HttpClientOptions());

ProxyOptions environmentProxy = ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration());
ProxyOptions environmentProxy = loadEnvironmentProxy();
io.vertx.core.net.ProxyOptions proxyOptions = httpClient.buildOptions.getProxyOptions();
if (environmentProxy == null) {
assertNull(proxyOptions);
Expand All @@ -62,6 +62,15 @@ public void defaultOptionsReturnsBaseClient() {
}
}

/*
* Loads the environment proxy the way VertxHttpClientBuilder does, unresolved. Resolving it would make
* getHostName() perform a reverse DNS lookup when the proxy host is an IP address, returning a name that doesn't
* match the host the client was configured with.
*/
private static ProxyOptions loadEnvironmentProxy() {
return ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration(), true);
}

@Test
public void optionsWithAProxy() {
ProxyOptions proxyOptions = new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888));
Expand Down
Loading