diff --git a/servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/ProxyTunnel.java b/servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/ProxyTunnel.java index 938aae245e..7a3c9e8179 100644 --- a/servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/ProxyTunnel.java +++ b/servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/ProxyTunnel.java @@ -1,5 +1,5 @@ /* - * Copyright © 2020 Apple Inc. and the ServiceTalk project authors + * Copyright © 2020-2021 Apple Inc. and the ServiceTalk project authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,6 +61,7 @@ public void close() throws Exception { HostAndPort startProxy() throws IOException { serverSocket = new ServerSocket(0, 50, getLoopbackAddress()); + final InetSocketAddress serverSocketAddress = (InetSocketAddress) serverSocket.getLocalSocketAddress(); executor.submit(() -> { while (!executor.isShutdown()) { final Socket socket = serverSocket.accept(); @@ -86,7 +87,8 @@ HostAndPort startProxy() throws IOException { } return null; }); - return HostAndPort.of((InetSocketAddress) serverSocket.getLocalSocketAddress()); + + return HostAndPort.of(serverSocketAddress.getAddress().getHostAddress(), serverSocketAddress.getPort()); } void badResponseProxy() {