@@ -61,14 +61,14 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
6161 def initializer = new InternalStreamConnectionInitializer (SINGLE , null , null , [], null )
6262
6363 when :
64- enqueueSuccessfulReplies(false , null )
64+ enqueueSuccessfulReplies(false , 123 )
6565 def description = initializer. startHandshake(internalConnection, operationContext)
6666 description = initializer. finishHandshake(internalConnection, description, operationContext)
6767 def connectionDescription = description. connectionDescription
6868 def serverDescription = description. serverDescription
6969
7070 then :
71- connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, null )
71+ connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, 123 )
7272 serverDescription == getExpectedServerDescription(serverDescription)
7373 }
7474
@@ -77,7 +77,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
7777 def initializer = new InternalStreamConnectionInitializer (SINGLE , null , null , [], null )
7878
7979 when :
80- enqueueSuccessfulReplies(false , null )
80+ enqueueSuccessfulReplies(false , 123 )
8181 def futureCallback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
8282 initializer. startHandshakeAsync(internalConnection, operationContext, futureCallback)
8383 def description = futureCallback. get()
@@ -88,7 +88,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
8888 def serverDescription = description. serverDescription
8989
9090 then :
91- connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, null )
91+ connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, 123 )
9292 serverDescription == getExpectedServerDescription(serverDescription)
9393 }
9494
@@ -106,20 +106,6 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
106106 connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, 123 )
107107 }
108108
109- def ' should create correct description with server connection id from hello' () {
110- given :
111- def initializer = new InternalStreamConnectionInitializer (SINGLE , null , null , [], null )
112-
113- when :
114- enqueueSuccessfulRepliesWithConnectionIdIsHelloResponse(false , 123 )
115- def internalDescription = initializer. startHandshake(internalConnection, operationContext)
116- def connectionDescription = initializer. finishHandshake(internalConnection, internalDescription, operationContext)
117- .connectionDescription
118-
119- then :
120- connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, 123 )
121- }
122-
123109 def ' should create correct description with server connection id asynchronously' () {
124110 given :
125111 def initializer = new InternalStreamConnectionInitializer (SINGLE , null , null , [], null )
@@ -137,31 +123,13 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
137123 connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, 123 )
138124 }
139125
140- def ' should create correct description with server connection id from hello asynchronously' () {
141- given :
142- def initializer = new InternalStreamConnectionInitializer (SINGLE , null , null , [], null )
143-
144- when :
145- enqueueSuccessfulRepliesWithConnectionIdIsHelloResponse(false , 123 )
146- def futureCallback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
147- initializer. startHandshakeAsync(internalConnection, operationContext, futureCallback)
148- def description = futureCallback. get()
149- futureCallback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
150- initializer. finishHandshakeAsync(internalConnection, description, operationContext, futureCallback)
151- description = futureCallback. get()
152- def connectionDescription = description. connectionDescription
153-
154- then :
155- connectionDescription == getExpectedConnectionDescription(connectionDescription. connectionId. localValue, 123 )
156- }
157-
158126 def ' should authenticate' () {
159127 given :
160128 def firstAuthenticator = Mock (Authenticator )
161129 def initializer = new InternalStreamConnectionInitializer (SINGLE , firstAuthenticator, null , [], null )
162130
163131 when :
164- enqueueSuccessfulReplies(false , null )
132+ enqueueSuccessfulReplies(false , 123 )
165133
166134 def internalDescription = initializer. startHandshake(internalConnection, operationContext)
167135 def connectionDescription = initializer. finishHandshake(internalConnection, internalDescription, operationContext)
@@ -178,7 +146,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
178146 def initializer = new InternalStreamConnectionInitializer (SINGLE , authenticator, null , [], null )
179147
180148 when :
181- enqueueSuccessfulReplies(false , null )
149+ enqueueSuccessfulReplies(false , 123 )
182150
183151 def futureCallback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
184152 initializer. startHandshakeAsync(internalConnection, operationContext, futureCallback)
@@ -198,7 +166,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
198166 def initializer = new InternalStreamConnectionInitializer (SINGLE , authenticator, null , [], null )
199167
200168 when :
201- enqueueSuccessfulReplies(true , null )
169+ enqueueSuccessfulReplies(true , 123 )
202170
203171 def internalDescription = initializer. startHandshake(internalConnection, operationContext)
204172 def connectionDescription = initializer. finishHandshake(internalConnection, internalDescription, operationContext)
@@ -215,7 +183,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
215183 def initializer = new InternalStreamConnectionInitializer (SINGLE , authenticator, null , [], null )
216184
217185 when :
218- enqueueSuccessfulReplies(true , null )
186+ enqueueSuccessfulReplies(true , 123 )
219187
220188 def futureCallback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
221189 initializer. startHandshakeAsync(internalConnection, operationContext, futureCallback)
@@ -240,7 +208,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
240208 }
241209
242210 when :
243- enqueueSuccessfulReplies(false , null )
211+ enqueueSuccessfulReplies(false , 123 )
244212 if (async) {
245213 def callback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
246214 initializer. startHandshakeAsync(internalConnection, operationContext, callback)
@@ -277,7 +245,7 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
277245 }
278246
279247 when :
280- enqueueSuccessfulReplies(false , null )
248+ enqueueSuccessfulReplies(false , 123 )
281249 if (async) {
282250 def callback = new FutureResultCallback<InternalConnectionInitializationDescription > ()
283251 initializer. startHandshakeAsync(internalConnection, operationContext, callback)
@@ -477,25 +445,12 @@ class InternalStreamConnectionInitializerSpecification extends Specification {
477445 }
478446
479447 def enqueueSuccessfulReplies (final boolean isArbiter , final Integer serverConnectionId ) {
480- internalConnection. enqueueReply(buildSuccessfulReply(
481- ' {ok: 1, ' +
482- ' maxWireVersion: 3' +
483- (isArbiter ? ' , isreplicaset: true, arbiterOnly: true' : ' ' ) +
484- ' }' ))
485- internalConnection. enqueueReply(buildSuccessfulReply(
486- ' {ok: 1 ' +
487- (serverConnectionId == null ? ' ' : ' , connectionId: ' + serverConnectionId) +
488- ' }' ))
489- }
490-
491- def enqueueSuccessfulRepliesWithConnectionIdIsHelloResponse (final boolean isArbiter , final Integer serverConnectionId ) {
492448 internalConnection. enqueueReply(buildSuccessfulReply(
493449 ' {ok: 1, ' +
494450 ' maxWireVersion: 3,' +
495451 ' connectionId: ' + serverConnectionId +
496452 (isArbiter ? ' , isreplicaset: true, arbiterOnly: true' : ' ' ) +
497453 ' }' ))
498- internalConnection. enqueueReply(buildSuccessfulReply(' {ok: 1, versionArray : [3, 0, 0]}' ))
499454 }
500455
501456 def enqueueSpeculativeAuthenticationResponsesForScramSha256 () {
0 commit comments