Skip to content

Commit

Permalink
Fix ProxyHelperTest on JDK@HEAD
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 520922614
Change-Id: Idcfe6c038fe1340fe5fed2518ebf8d1bccaa0a3e
  • Loading branch information
Wyverald authored and copybara-github committed Mar 31, 2023
1 parent b27d1a3 commit 4c85356
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,28 @@ public class ProxyHelperTest {
public void testCreateIfNeededHttpLowerCase() throws Exception {
ProxyHelper helper = new ProxyHelper(ImmutableMap.of("http_proxy", "http://my.example.com"));
Proxy proxy = helper.createProxyIfNeeded(new URL("http://www.something.com"));
assertThat(proxy.toString()).endsWith("my.example.com:80");
assertThat(proxy.toString()).containsMatch("my\\.example\\.com(/<unresolved>)?:80$");
}

@Test
public void testCreateIfNeededHttpUpperCase() throws Exception {
ProxyHelper helper = new ProxyHelper(ImmutableMap.of("HTTP_PROXY", "http://my.example.com"));
Proxy proxy = helper.createProxyIfNeeded(new URL("http://www.something.com"));
assertThat(proxy.toString()).endsWith("my.example.com:80");
assertThat(proxy.toString()).containsMatch("my\\.example\\.com(/<unresolved>)?:80$");
}

@Test
public void testCreateIfNeededHttpsLowerCase() throws Exception {
ProxyHelper helper = new ProxyHelper(ImmutableMap.of("https_proxy", "https://my.example.com"));
Proxy proxy = helper.createProxyIfNeeded(new URL("https://www.something.com"));
assertThat(proxy.toString()).endsWith("my.example.com:443");
assertThat(proxy.toString()).containsMatch("my\\.example\\.com(/<unresolved>)?:443$");
}

@Test
public void testCreateIfNeededHttpsUpperCase() throws Exception {
ProxyHelper helper = new ProxyHelper(ImmutableMap.of("HTTPS_PROXY", "https://my.example.com"));
Proxy proxy = helper.createProxyIfNeeded(new URL("https://www.something.com"));
assertThat(proxy.toString()).endsWith("my.example.com:443");
assertThat(proxy.toString()).containsMatch("my\\.example\\.com(/<unresolved>)?:443$");
}

@Test
Expand Down Expand Up @@ -141,7 +141,7 @@ public void testCreateIfNeededNoProxyNoMatchSubstring() throws Exception {
"HTTPS_PROXY",
"https://my.example.com"));
Proxy proxy = helper.createProxyIfNeeded(new URL("https://www.not-example.com"));
assertThat(proxy.toString()).endsWith("my.example.com:443");
assertThat(proxy.toString()).containsMatch("my\\.example\\.com(/<unresolved>)?:443$");
}

@Test
Expand Down

0 comments on commit 4c85356

Please sign in to comment.