Merge "Use consistent addresses in SSLCertificateSocketFactoryTest." am: 14e08ef40e

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2487883

Change-Id: I493bc481e79d191c2683028589512f797b6a0f37
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-04-12 04:17:37 +00:00
committed by Automerger Merge Worker

View File

@@ -66,7 +66,6 @@ public class SSLCertificateSocketFactoryTest {
InetAddress[] addresses;
try {
addresses = InetAddress.getAllByName(TEST_HOST);
mTestHostAddress = addresses[0];
} catch (UnknownHostException uhe) {
throw new AssertionError(
"Unable to test SSLCertificateSocketFactory: cannot resolve " + TEST_HOST, uhe);
@@ -76,10 +75,11 @@ public class SSLCertificateSocketFactoryTest {
.map(addr -> new InetSocketAddress(addr, HTTPS_PORT))
.collect(Collectors.toList());
// Find the local IP address which will be used to connect to TEST_HOST.
// Find the local and remote IP addresses which will be used to connect to TEST_HOST.
try {
Socket testSocket = new Socket(TEST_HOST, HTTPS_PORT);
mLocalAddress = testSocket.getLocalAddress();
mTestHostAddress = testSocket.getInetAddress();
testSocket.close();
} catch (IOException ioe) {
throw new AssertionError(""