Merge "Address aosp/1740740 leftover comments"

This commit is contained in:
Paul Hu
2021-07-26 09:49:27 +00:00
committed by Gerrit Code Review

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 { private void assertBindSocketToNetworkSuccess(final Network network) throws Exception {
final CompletableFuture<Boolean> future = new CompletableFuture<>(); final CompletableFuture<Boolean> future = new CompletableFuture<>();
final ExecutorService executor = Executors.newSingleThreadExecutor(); final ExecutorService executor = Executors.newSingleThreadExecutor();
try { try {
executor.execute(() -> { executor.execute(() -> {
for (int i = 0; i < 30; i++) { for (int i = 0; i < 300; i++) {
waitForMs(100); SystemClock.sleep(10);
try (Socket socket = new Socket()) { try (Socket socket = new Socket()) {
network.bindSocket(socket); network.bindSocket(socket);