Search in sources :

Example 1 with SslSettings

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);
}
Also used : SslSettings(com.mongodb.connection.SslSettings) ClusterSettings(com.mongodb.connection.ClusterSettings) SocketSettings(com.mongodb.connection.SocketSettings) ConnectionPoolSettings(com.mongodb.connection.ConnectionPoolSettings)

Aggregations

ClusterSettings (com.mongodb.connection.ClusterSettings)1 ConnectionPoolSettings (com.mongodb.connection.ConnectionPoolSettings)1 SocketSettings (com.mongodb.connection.SocketSettings)1 SslSettings (com.mongodb.connection.SslSettings)1