@@ -1121,10 +1121,17 @@ public void updateAddresses_disjoint_ready_twice() {
11211121 loadBalancer .acceptResolvedAddresses (
11221122 ResolvedAddresses .newBuilder ().setAddresses (newServers ).setAttributes (affinity ).build ());
11231123 inOrder .verify (mockSubchannel1 ).shutdown ();
1124- inOrder .verify (mockHelper ).updateBalancingState (eq (CONNECTING ), pickerCaptor .capture ());
1124+ inOrder .verify (mockHelper ).updateBalancingState (eq (IDLE ), pickerCaptor .capture ());
1125+ inOrder .verify (mockSubchannel3 , never ()).start (stateListenerCaptor .capture ());
1126+
1127+ // Trigger connection creation
1128+ picker = pickerCaptor .getValue ();
1129+ assertEquals (PickResult .withNoResult (), picker .pickSubchannel (mockArgs ));
11251130 inOrder .verify (mockSubchannel3 ).start (stateListenerCaptor .capture ());
11261131 SubchannelStateListener stateListener3 = stateListenerCaptor .getValue ();
11271132 inOrder .verify (mockSubchannel3 ).requestConnection ();
1133+ stateListener3 .onSubchannelState (ConnectivityStateInfo .forNonError (CONNECTING ));
1134+ inOrder .verify (mockHelper ).updateBalancingState (eq (CONNECTING ), pickerCaptor .capture ());
11281135
11291136 if (enableHappyEyeballs ) {
11301137 forwardTimeByConnectionDelay ();
@@ -1171,17 +1178,19 @@ public void updateAddresses_disjoint_ready_twice() {
11711178 loadBalancer .acceptResolvedAddresses (
11721179 ResolvedAddresses .newBuilder ().setAddresses (newestServers ).setAttributes (affinity ).build ());
11731180 inOrder .verify (mockSubchannel3 ).shutdown ();
1174- inOrder .verify (mockHelper ).updateBalancingState (eq (CONNECTING ), pickerCaptor .capture ());
1175- inOrder .verify (mockSubchannel1n2 ).start (stateListenerCaptor .capture ());
1176- stateListener = stateListenerCaptor .getValue ();
1177- assertEquals (CONNECTING , loadBalancer .getConcludedConnectivityState ());
1181+ inOrder .verify (mockHelper ).updateBalancingState (eq (IDLE ), pickerCaptor .capture ());
1182+ assertEquals (IDLE , loadBalancer .getConcludedConnectivityState ());
11781183 picker = pickerCaptor .getValue ();
11791184
11801185 // Calling pickSubchannel() twice gave the same result
11811186 assertEquals (picker .pickSubchannel (mockArgs ), picker .pickSubchannel (mockArgs ));
11821187
11831188 // But the picker calls requestConnection() only once
1189+ inOrder .verify (mockSubchannel1n2 ).start (stateListenerCaptor .capture ());
1190+ stateListener = stateListenerCaptor .getValue ();
11841191 inOrder .verify (mockSubchannel1n2 ).requestConnection ();
1192+ stateListener .onSubchannelState (ConnectivityStateInfo .forNonError (CONNECTING ));
1193+ inOrder .verify (mockHelper ).updateBalancingState (eq (CONNECTING ), pickerCaptor .capture ());
11851194 assertEquals (PickResult .withNoResult (), pickerCaptor .getValue ().pickSubchannel (mockArgs ));
11861195 assertEquals (CONNECTING , loadBalancer .getConcludedConnectivityState ());
11871196
0 commit comments