Source:
protected final CompletionStage<CqlSession> buildDefaultSessionAsync() { try { DriverConfigLoader configLoader = buildIfNull(this.configLoader, this::defaultConfigLoader); DriverExecutionProfile defaultConfig = configLoader.getInitialConfig().getDefaultProfile(); if (cloudConfigInputStream == null) { String configUrlString = defaultConfig.getString(DefaultDriverOption.CLOUD_SECURE_CONNECT_BUNDLE, null); if (configUrlString != null) { cloudConfigInputStream = () -> getURL(configUrlString).openStream(); } } List<String> configContactPoints = defaultConfig.getStringList(DefaultDriverOption.CONTACT_POINTS, Collections.emptyList()); if (cloudConfigInputStream != null) { if (!programmaticContactPoints.isEmpty() || !configContactPoints.isEmpty()) { throw new IllegalStateException( "Can't use withCloudSecureConnectBundle and addContactPoint(s). They are mutually exclusive."); } if (sslConfigured) { throw new IllegalStateException( "Can't use withCloudSecureConnectBundle and explicitly specify ssl configuration. They are mutually exclusive."); } CloudConfig cloudConfig = new CloudConfigFactory().createCloudConfig(cloudConfigInputStream.call()); addContactEndPoints(cloudConfig.getEndPoints()); withLocalDatacenter(cloudConfig.getLocalDatacenter()); withSslEngineFactory(cloudConfig.getSslEngineFactory()); withCloudProxyAddress(cloudConfig.getProxyAddress()); if (cloudConfig.getAuthProvider().isPresent()) { withAuthProvider(cloudConfig.getAuthProvider().get()); } } boolean resolveAddresses = defaultConfig.getBoolean(DefaultDriverOption.RESOLVE_CONTACT_POINTS, true); Set<EndPoint> contactPoints = ContactPoints.merge(programmaticContactPoints, configContactPoints, resolveAddresses); if (keyspace == null && defaultConfig.isDefined(DefaultDriverOption.SESSION_KEYSPACE)) { keyspace = CqlIdentifier.fromCql(defaultConfig.getString(DefaultDriverOption.SESSION_KEYSPACE)); } return DefaultSession.init( (InternalDriverContext) buildContext(configLoader, programmaticArgumentsBuilder.build()), contactPoints, keyspace); } catch (Throwable t) { return CompletableFutures.failedFuture(t); } }

Target:
protected final CompletionStage<CqlSession> buildDefaultSessionAsync() { try { DriverConfigLoader configLoader = buildIfNull(this.configLoader, this::defaultConfigLoader); DriverExecutionProfile defaultConfig = configLoader.getInitialConfig().getDefaultProfile(); if (cloudConfigInputStream == null) { String configUrlString = defaultConfig.getString(DefaultDriverOption.CLOUD_SECURE_CONNECT_BUNDLE, null); if (configUrlString != null) { cloudConfigInputStream = () -> getURL(configUrlString).openStream(); } } List<String> configContactPoints = defaultConfig.getStringList(DefaultDriverOption.CONTACT_POINTS, Collections.emptyList()); if (cloudConfigInputStream != null) { if (!programmaticContactPoints.isEmpty() || !configContactPoints.isEmpty()) { throw new IllegalStateException( "Can't use withCloudSecureConnectBundle and addContactPoint(s). They are mutually exclusive."); } String configuredSSLFactory = defaultConfig.getString(DefaultDriverOption.SSL_ENGINE_FACTORY_CLASS, null); if (sslConfigured || configuredSSLFactory != null) { throw new IllegalStateException( "Can't use withCloudSecureConnectBundle and explicitly specify ssl configuration. They are mutually exclusive."); } CloudConfig cloudConfig = new CloudConfigFactory().createCloudConfig(cloudConfigInputStream.call()); addContactEndPoints(cloudConfig.getEndPoints()); withLocalDatacenter(cloudConfig.getLocalDatacenter()); withSslEngineFactory(cloudConfig.getSslEngineFactory()); withCloudProxyAddress(cloudConfig.getProxyAddress()); if (cloudConfig.getAuthProvider().isPresent()) { withAuthProvider(cloudConfig.getAuthProvider().get()); } } boolean resolveAddresses = defaultConfig.getBoolean(DefaultDriverOption.RESOLVE_CONTACT_POINTS, true); Set<EndPoint> contactPoints = ContactPoints.merge(programmaticContactPoints, configContactPoints, resolveAddresses); if (keyspace == null && defaultConfig.isDefined(DefaultDriverOption.SESSION_KEYSPACE)) { keyspace = CqlIdentifier.fromCql(defaultConfig.getString(DefaultDriverOption.SESSION_KEYSPACE)); } return DefaultSession.init( (InternalDriverContext) buildContext(configLoader, programmaticArgumentsBuilder.build()), contactPoints, keyspace); } catch (Throwable t) { return CompletableFutures.failedFuture(t); } }