@@ -1121,10 +1121,17 @@ public void updateAddresses_disjoint_ready_twice() {
1121
1121
loadBalancer .acceptResolvedAddresses (
1122
1122
ResolvedAddresses .newBuilder ().setAddresses (newServers ).setAttributes (affinity ).build ());
1123
1123
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 ));
1125
1130
inOrder .verify (mockSubchannel3 ).start (stateListenerCaptor .capture ());
1126
1131
SubchannelStateListener stateListener3 = stateListenerCaptor .getValue ();
1127
1132
inOrder .verify (mockSubchannel3 ).requestConnection ();
1133
+ stateListener3 .onSubchannelState (ConnectivityStateInfo .forNonError (CONNECTING ));
1134
+ inOrder .verify (mockHelper ).updateBalancingState (eq (CONNECTING ), pickerCaptor .capture ());
1128
1135
1129
1136
if (enableHappyEyeballs ) {
1130
1137
forwardTimeByConnectionDelay ();
@@ -1171,17 +1178,19 @@ public void updateAddresses_disjoint_ready_twice() {
1171
1178
loadBalancer .acceptResolvedAddresses (
1172
1179
ResolvedAddresses .newBuilder ().setAddresses (newestServers ).setAttributes (affinity ).build ());
1173
1180
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 ());
1178
1183
picker = pickerCaptor .getValue ();
1179
1184
1180
1185
// Calling pickSubchannel() twice gave the same result
1181
1186
assertEquals (picker .pickSubchannel (mockArgs ), picker .pickSubchannel (mockArgs ));
1182
1187
1183
1188
// But the picker calls requestConnection() only once
1189
+ inOrder .verify (mockSubchannel1n2 ).start (stateListenerCaptor .capture ());
1190
+ stateListener = stateListenerCaptor .getValue ();
1184
1191
inOrder .verify (mockSubchannel1n2 ).requestConnection ();
1192
+ stateListener .onSubchannelState (ConnectivityStateInfo .forNonError (CONNECTING ));
1193
+ inOrder .verify (mockHelper ).updateBalancingState (eq (CONNECTING ), pickerCaptor .capture ());
1185
1194
assertEquals (PickResult .withNoResult (), pickerCaptor .getValue ().pickSubchannel (mockArgs ));
1186
1195
assertEquals (CONNECTING , loadBalancer .getConcludedConnectivityState ());
1187
1196
0 commit comments