diff --git a/spring-statemachine-build-tests/src/test/java/org/springframework/statemachine/buildtests/tck/mongodb/MongoDbRule.java b/spring-statemachine-build-tests/src/test/java/org/springframework/statemachine/buildtests/tck/mongodb/MongoDbRule.java index b1cf8233..9fac2a14 100644 --- a/spring-statemachine-build-tests/src/test/java/org/springframework/statemachine/buildtests/tck/mongodb/MongoDbRule.java +++ b/spring-statemachine-build-tests/src/test/java/org/springframework/statemachine/buildtests/tck/mongodb/MongoDbRule.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,8 @@ public class MongoDbRule extends TestWatcher implements TestRule { public Statement apply(Statement base, Description description) { MongoClient client = null; try { - client = new MongoClient(new ServerAddress(), MongoClientOptions.builder().connectTimeout(50).build()); + client = new MongoClient(new ServerAddress(), + MongoClientOptions.builder().connectTimeout(50).serverSelectionTimeout(50).build()); client.getAddress(); } catch (Exception e) { return super.apply(new Statement() { diff --git a/spring-statemachine-data/mongodb/src/test/java/org/springframework/statemachine/data/mongodb/MongoDbRule.java b/spring-statemachine-data/mongodb/src/test/java/org/springframework/statemachine/data/mongodb/MongoDbRule.java index 8709ba05..d56a255b 100644 --- a/spring-statemachine-data/mongodb/src/test/java/org/springframework/statemachine/data/mongodb/MongoDbRule.java +++ b/spring-statemachine-data/mongodb/src/test/java/org/springframework/statemachine/data/mongodb/MongoDbRule.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,8 @@ public class MongoDbRule extends TestWatcher implements TestRule { public Statement apply(Statement base, Description description) { MongoClient client = null; try { - client = new MongoClient(new ServerAddress(), MongoClientOptions.builder().connectTimeout(50).build()); + client = new MongoClient(new ServerAddress(), + MongoClientOptions.builder().connectTimeout(50).serverSelectionTimeout(50).build()); client.getAddress(); } catch (Exception e) { return super.apply(new Statement() {