@@ -201,7 +201,13 @@ public void tearDown() {
201201
202202 @ Test
203203 public void lb_serverStatusCodeConversion () throws Exception {
204- deliverResolvedAddresses ();
204+ helper .getSynchronizationContext ().execute (() -> {
205+ try {
206+ deliverResolvedAddresses ();
207+ } catch (Exception e ) {
208+ throw new RuntimeException (e );
209+ }
210+ });
205211 InOrder inOrder = inOrder (helper );
206212 inOrder .verify (helper )
207213 .updateBalancingState (eq (ConnectivityState .CONNECTING ), pickerCaptor .capture ());
@@ -236,7 +242,13 @@ public void lb_serverStatusCodeConversion() throws Exception {
236242
237243 @ Test
238244 public void lb_working_withDefaultTarget_rlsResponding () throws Exception {
239- deliverResolvedAddresses ();
245+ helper .getSynchronizationContext ().execute (() -> {
246+ try {
247+ deliverResolvedAddresses ();
248+ } catch (Exception e ) {
249+ throw new RuntimeException (e );
250+ }
251+ });
240252 InOrder inOrder = inOrder (helper );
241253 inOrder .verify (helper )
242254 .updateBalancingState (eq (ConnectivityState .CONNECTING ), pickerCaptor .capture ());
@@ -393,7 +405,13 @@ public void lb_working_withoutDefaultTarget_noRlsResponse() throws Exception {
393405 public void lb_working_withDefaultTarget_noRlsResponse () throws Exception {
394406 fakeThrottler .nextResult = true ;
395407
396- deliverResolvedAddresses ();
408+ helper .getSynchronizationContext ().execute (() -> {
409+ try {
410+ deliverResolvedAddresses ();
411+ } catch (Exception e ) {
412+ throw new RuntimeException (e );
413+ }
414+ });
397415 InOrder inOrder = inOrder (helper );
398416 inOrder .verify (helper )
399417 .updateBalancingState (eq (ConnectivityState .CONNECTING ), pickerCaptor .capture ());
@@ -535,7 +553,13 @@ public void lb_working_withoutDefaultTarget() throws Exception {
535553
536554 @ Test
537555 public void lb_nameResolutionFailed () throws Exception {
538- deliverResolvedAddresses ();
556+ helper .getSynchronizationContext ().execute (() -> {
557+ try {
558+ deliverResolvedAddresses ();
559+ } catch (Exception e ) {
560+ throw new RuntimeException (e );
561+ }
562+ });
539563 InOrder inOrder = inOrder (helper );
540564 inOrder .verify (helper )
541565 .updateBalancingState (eq (ConnectivityState .CONNECTING ), pickerCaptor .capture ());
0 commit comments