OkHttpClientTransportTest's proxy to use localhost

Fixes #8080. The address 0.0.0.0 (that comes from new Socket(0).
.getLocalSocketAddress()) is for listening with a server, but it
is not meant to be used as the destination address as per
"3.2.1.3 Addressing" in RFC 1122
This commit is contained in:
Tomo Suzuki 2021-04-13 21:50:32 -04:00 committed by Eric Anderson
parent d25ebaf57d
commit 4ad49266ec
1 changed files with 6 additions and 3 deletions

View File

@ -1866,7 +1866,8 @@ public class OkHttpClientTransportTest {
INITIAL_WINDOW_SIZE,
HttpConnectProxiedSocketAddress.newBuilder()
.setTargetAddress(targetAddress)
.setProxyAddress(serverSocket.getLocalSocketAddress()).build(),
.setProxyAddress(new InetSocketAddress("localhost", serverSocket.getLocalPort()))
.build(),
tooManyPingsRunnable,
DEFAULT_MAX_INBOUND_METADATA_SIZE,
transportTracer,
@ -1923,7 +1924,8 @@ public class OkHttpClientTransportTest {
INITIAL_WINDOW_SIZE,
HttpConnectProxiedSocketAddress.newBuilder()
.setTargetAddress(targetAddress)
.setProxyAddress(serverSocket.getLocalSocketAddress()).build(),
.setProxyAddress(new InetSocketAddress("localhost", serverSocket.getLocalPort()))
.build(),
tooManyPingsRunnable,
DEFAULT_MAX_INBOUND_METADATA_SIZE,
transportTracer,
@ -1979,7 +1981,8 @@ public class OkHttpClientTransportTest {
INITIAL_WINDOW_SIZE,
HttpConnectProxiedSocketAddress.newBuilder()
.setTargetAddress(targetAddress)
.setProxyAddress(serverSocket.getLocalSocketAddress()).build(),
.setProxyAddress(new InetSocketAddress("localhost", serverSocket.getLocalPort()))
.build(),
tooManyPingsRunnable,
DEFAULT_MAX_INBOUND_METADATA_SIZE,
transportTracer,