-
Type: Task
-
Resolution: Works as Designed
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Configuration
-
None
-
Environment:prod
I am forcing the MongoClient to use SSL with TLS 1.2. Here is the code . I am getting the error: incompatible types when I am passing to the MongoClientOptions.Builder.
Is there a better approach for enforcing TLS 1.2 for the client connection . I am using java driver 3.4.2 connecting to mongoDB 3.0.6.
SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); MongoClientOptions.Builder builder = MongoClientOptions.builder().socketFactory((SSLSocketFactory)sslContext.getSocketFactory()).build(); MongoClientOptions sslOptions builder.sslEnabled(true).sslInvalidHostNameAllowed(true).build();
java:87: error: incompatible types MongoClientOptions.Builder builder = MongoClientOptions.builder().socketFactory(sslContext.getSocketFactory()).build(); ^ required: Builder found: MongoClientOptions 1 error