Permalink
Browse files

Fixes issue #1078 (#1079)

* Fixes issue #1078
Check the "socksProxyHost" system property not only for null, but also for emptiness

* #1078: Added test and fixed code style issues
  • Loading branch information...
JCzogalla authored and davecramer committed Jan 19, 2018
1 parent fe463bc commit 0d51370b68cd26ccfa92b0bae4a66da1015cf9ee
@@ -48,7 +48,8 @@ public int hashCode() {
}
public Boolean shouldResolve() {
if (System.getProperty("socksProxyHost") == null) {
String socksProxy = System.getProperty("socksProxyHost");
if (socksProxy == null || socksProxy.trim().isEmpty()) {
return true;
}
return matchesNonProxyHosts();
@@ -32,6 +32,20 @@ public void testShouldResolve() throws Exception {
assertTrue(hostSpec.shouldResolve());
}
@Test
public void testShouldResolveWithEmptySocksProxyHost() throws Exception {
System.setProperty("socksProxyHost", "");
HostSpec hostSpec = new HostSpec("localhost", 5432);
assertFalse(hostSpec.shouldResolve());
}
@Test
public void testShouldResolveWithWhiteSpaceSocksProxyHost() throws Exception {
System.setProperty("socksProxyHost", " ");
HostSpec hostSpec = new HostSpec("localhost", 5432);
assertFalse(hostSpec.shouldResolve());
}
@Test
public void testShouldResolveWithSocksProxyHost() throws Exception {
System.setProperty("socksProxyHost", "fake-socks-proxy");

0 comments on commit 0d51370

Please sign in to comment.