@@ -21,6 +21,7 @@ import com.mongodb.MongoSocketReadTimeoutException
2121import com.mongodb.OperationFunctionalSpecification
2222import com.mongodb.ServerAddress
2323import com.mongodb.connection.AsynchronousSocketChannelStreamFactory
24+ import com.mongodb.connection.ClusterConnectionMode
2425import com.mongodb.connection.ClusterId
2526import com.mongodb.connection.ServerId
2627import com.mongodb.connection.SocketSettings
@@ -39,7 +40,6 @@ import static com.mongodb.ClusterFixture.getServerApi
3940import static com.mongodb.ClusterFixture.getSslSettings
4041import static com.mongodb.internal.connection.CommandHelper.executeCommand
4142
42- @IgnoreIf ({ System .getProperty(' ignoreSlowUnitTests' ) == ' true' })
4343@Slow
4444class AsyncStreamTimeoutsSpecification extends OperationFunctionalSpecification {
4545
@@ -49,9 +49,9 @@ class AsyncStreamTimeoutsSpecification extends OperationFunctionalSpecification
4949 @IgnoreIf ({ getSslSettings().isEnabled() })
5050 def ' should throw a MongoSocketOpenException when the AsynchronousSocket Stream fails to open' () {
5151 given :
52- def connection = new InternalStreamConnectionFactory (
52+ def connection = new InternalStreamConnectionFactory (ClusterConnectionMode . SINGLE ,
5353 new AsynchronousSocketChannelStreamFactory (openSocketSettings, getSslSettings()), getCredentialWithCache(), null , null ,
54- [], getServerApi())
54+ [], null , getServerApi())
5555 .create(new ServerId (new ClusterId (), new ServerAddress (new InetSocketAddress (' 192.168.255.255' , 27017 ))))
5656
5757 when :
@@ -64,17 +64,17 @@ class AsyncStreamTimeoutsSpecification extends OperationFunctionalSpecification
6464 @IgnoreIf ({ getSslSettings().isEnabled() })
6565 def ' should throw a MongoSocketReadTimeoutException with the AsynchronousSocket stream' () {
6666 given :
67- def connection = new InternalStreamConnectionFactory (
67+ def connection = new InternalStreamConnectionFactory (ClusterConnectionMode . SINGLE ,
6868 new AsynchronousSocketChannelStreamFactory (readSocketSettings, getSslSettings()), getCredentialWithCache(), null , null ,
69- [], getServerApi(), ). create(new ServerId (new ClusterId (), getPrimary()))
69+ [], null , getServerApi()). create(new ServerId (new ClusterId (), getPrimary()))
7070 connection. open()
7171
7272 getCollectionHelper(). insertDocuments(new BsonDocument (' _id' , new BsonInt32 (1 )));
7373 def countCommand = new BsonDocument (' count' , new BsonString (getCollectionName()))
7474 countCommand. put(' query' , new BsonDocument (' $where' , new BsonString (' sleep(5050); return true;' )))
7575
7676 when :
77- executeCommand(getDatabaseName(), countCommand, connection)
77+ executeCommand(getDatabaseName(), countCommand, getServerApi(), connection)
7878
7979 then :
8080 thrown(MongoSocketReadTimeoutException )
@@ -85,9 +85,10 @@ class AsyncStreamTimeoutsSpecification extends OperationFunctionalSpecification
8585
8686 def ' should throw a MongoSocketOpenException when the Netty Stream fails to open' () {
8787 given :
88- def connection = new InternalStreamConnectionFactory (
89- new NettyStreamFactory (openSocketSettings, getSslSettings()), getCredentialWithCache(), null , null , [], getServerApi(),
90- ). create(new ServerId (new ClusterId (), new ServerAddress (new InetSocketAddress (' 192.168.255.255' , 27017 ))))
88+ def connection = new InternalStreamConnectionFactory (ClusterConnectionMode . SINGLE ,
89+ new NettyStreamFactory (openSocketSettings, getSslSettings()), getCredentialWithCache(), null , null ,
90+ [], null , getServerApi()). create(new ServerId (new ClusterId (),
91+ new ServerAddress (new InetSocketAddress (' 192.168.255.255' , 27017 ))))
9192
9293 when :
9394 connection. open()
@@ -99,17 +100,17 @@ class AsyncStreamTimeoutsSpecification extends OperationFunctionalSpecification
99100
100101 def ' should throw a MongoSocketReadTimeoutException with the Netty stream' () {
101102 given :
102- def connection = new InternalStreamConnectionFactory (
103- new NettyStreamFactory (readSocketSettings, getSslSettings()), getCredentialWithCache(), null , null , [], getServerApi(),
104- ) . create(new ServerId (new ClusterId (), getPrimary()), connectionGeneration )
103+ def connection = new InternalStreamConnectionFactory (ClusterConnectionMode . SINGLE ,
104+ new NettyStreamFactory (readSocketSettings, getSslSettings()), getCredentialWithCache(), null , null ,
105+ [], null , getServerApi()) . create(new ServerId (new ClusterId (), getPrimary()))
105106 connection. open()
106107
107108 getCollectionHelper(). insertDocuments(new BsonDocument (' _id' , new BsonInt32 (1 )));
108109 def countCommand = new BsonDocument (' count' , new BsonString (getCollectionName()))
109110 countCommand. put(' query' , new BsonDocument (' $where' , new BsonString (' sleep(5050); return true;' )))
110111
111112 when :
112- executeCommand(getDatabaseName(), countCommand, connection)
113+ executeCommand(getDatabaseName(), countCommand, getServerApi(), connection)
113114
114115 then :
115116 thrown(MongoSocketReadTimeoutException )
0 commit comments