use of com.mongodb.connection.SslSettings in project mongo-java-driver by mongodb.
the class Fixture method getMongoClientBuilderFromConnectionString.
public static MongoClientSettings.Builder getMongoClientBuilderFromConnectionString() {
SslSettings.Builder sslSettingsBuilder = SslSettings.builder().applyConnectionString(getConnectionString());
if (System.getProperty("java.version").startsWith("1.6.")) {
sslSettingsBuilder.invalidHostNameAllowed(true);
}
ClusterSettings clusterSettings = ClusterSettings.builder().applyConnectionString(getConnectionString()).build();
ConnectionPoolSettings connectionPoolSettings = ConnectionPoolSettings.builder().applyConnectionString(getConnectionString()).build();
SocketSettings socketSettings = SocketSettings.builder().applyConnectionString(getConnectionString()).build();
return MongoClientSettings.builder().clusterSettings(clusterSettings).connectionPoolSettings(connectionPoolSettings).serverSettings(ServerSettings.builder().build()).credentialList(getConnectionString().getCredentialList()).sslSettings(sslSettingsBuilder.build()).socketSettings(socketSettings);
}
Aggregations