mirror of https://github.com/grpc/grpc-java.git
interop-testing,okhttp,testing: update tests to pass with ipv6
This commit is contained in:
parent
7be1720fce
commit
5dc8a124bf
|
|
@ -99,7 +99,7 @@ public class Http2NettyTest extends AbstractInteropTest {
|
|||
|
||||
@Test(timeout = 10000)
|
||||
public void remoteAddr() {
|
||||
assertRemoteAddr("/127.0.0.1");
|
||||
assertRemoteAddr("/0:0:0:0:0:0:0:1");
|
||||
}
|
||||
|
||||
@Test(timeout = 10000)
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public class Http2OkHttpTest extends AbstractInteropTest {
|
|||
|
||||
@Override
|
||||
protected ManagedChannel createChannel() {
|
||||
OkHttpChannelBuilder builder = OkHttpChannelBuilder.forAddress("127.0.0.1", getPort())
|
||||
OkHttpChannelBuilder builder = OkHttpChannelBuilder.forAddress("::1", getPort())
|
||||
.maxInboundMessageSize(AbstractInteropTest.MAX_MESSAGE_SIZE)
|
||||
.connectionSpec(new ConnectionSpec.Builder(OkHttpChannelBuilder.DEFAULT_CONNECTION_SPEC)
|
||||
.cipherSuites(TestUtils.preferredTestCiphers().toArray(new String[0]))
|
||||
|
|
@ -142,7 +142,7 @@ public class Http2OkHttpTest extends AbstractInteropTest {
|
|||
|
||||
@Test(timeout = 10000)
|
||||
public void wrongHostNameFailHostnameVerification() throws Exception {
|
||||
OkHttpChannelBuilder builder = OkHttpChannelBuilder.forAddress("127.0.0.1", getPort())
|
||||
OkHttpChannelBuilder builder = OkHttpChannelBuilder.forAddress("::1", getPort())
|
||||
.connectionSpec(new ConnectionSpec.Builder(OkHttpChannelBuilder.DEFAULT_CONNECTION_SPEC)
|
||||
.cipherSuites(TestUtils.preferredTestCiphers().toArray(new String[0]))
|
||||
.tlsVersions(ConnectionSpec.MODERN_TLS.tlsVersions().toArray(new TlsVersion[0]))
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.junit.runners.JUnit4;
|
|||
public class OkHttpTransportTest extends AbstractTransportTest {
|
||||
private ClientTransportFactory clientFactory = OkHttpChannelBuilder
|
||||
// Although specified here, address is ignored because we never call build.
|
||||
.forAddress("127.0.0.1", 0)
|
||||
.forAddress("::1", 0)
|
||||
.negotiationType(NegotiationType.PLAINTEXT)
|
||||
.buildTransportFactory();
|
||||
|
||||
|
|
@ -82,14 +82,14 @@ public class OkHttpTransportTest extends AbstractTransportTest {
|
|||
|
||||
@Override
|
||||
protected String testAuthority(InternalServer server) {
|
||||
return "127.0.0.1:" + server.getPort();
|
||||
return "[::1]:" + server.getPort();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ManagedClientTransport newClientTransport(InternalServer server) {
|
||||
int port = server.getPort();
|
||||
return clientFactory.newClientTransport(
|
||||
new InetSocketAddress("127.0.0.1", port),
|
||||
new InetSocketAddress("::1", port),
|
||||
testAuthority(server),
|
||||
null /* agent */);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public class TestUtils {
|
|||
*/
|
||||
public static InetSocketAddress testServerAddress(int port) {
|
||||
try {
|
||||
InetAddress inetAddress = InetAddress.getByName("localhost");
|
||||
InetAddress inetAddress = InetAddress.getByName("::1");
|
||||
inetAddress = InetAddress.getByAddress(TEST_SERVER_HOST, inetAddress.getAddress());
|
||||
return new InetSocketAddress(inetAddress, port);
|
||||
} catch (UnknownHostException e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue