Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,18 @@ public void startWithHttp401PreventsSubsequentStart() throws Exception {

assertNotNull(callback1.awaitError());

// The background thread calls resultCallback.onError() before setting
// connection401Error, so the flag may not be true yet. Poll briefly to
// allow the background thread to complete.
long deadline = System.currentTimeMillis() + 1000;
while (System.currentTimeMillis() < deadline) {
TrackingCallback probe = new TrackingCallback();
sds.start(probe);
if (probe.errors.poll(50, TimeUnit.MILLISECONDS) == null) {
break; // connection401Error is now set; start() was a no-op
}
}

// Second start should be a no-op due to connection401Error flag
TrackingCallback callback2 = new TrackingCallback();
sds.start(callback2);
Expand Down
Loading