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

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

Change-Id: I8a901187e66a5f6dade6dfe36951949dcf80d458
This commit is contained in:
Paul Hu
2021-07-26 10:09:26 +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);