Merge "Address aosp/1740740 leftover comments" am: 1975a57e83 am: 1e594fa4db

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

Change-Id: Ia63b7b3720e73378ccb509116ce5366913392526
This commit is contained in:
Paul Hu
2021-07-26 10:21:28 +00:00
committed by Automerger Merge Worker

View File

@@ -2850,22 +2850,13 @@ public class ConnectivityManagerTest {
}
}
/** Wait for assigned time. */
private void waitForMs(long ms) {
try {
Thread.sleep(ms);
} catch (InterruptedException e) {
fail("Thread was interrupted");
}
}
private void assertBindSocketToNetworkSuccess(final Network network) throws Exception {
final CompletableFuture<Boolean> future = new CompletableFuture<>();
final ExecutorService executor = Executors.newSingleThreadExecutor();
try {
executor.execute(() -> {
for (int i = 0; i < 30; i++) {
waitForMs(100);
for (int i = 0; i < 300; i++) {
SystemClock.sleep(10);
try (Socket socket = new Socket()) {
network.bindSocket(socket);