### Question:
BulkProcessorObjectFactory implements ClientObjectFactory<TransportClient, BulkRequest> { ClientProvider<TransportClient> getClientProvider() { return auth == null ? new InsecureTransportClientProvider(clientSettings) : new SecureClientProvider(auth, clientSettings); } protected  BulkProcessorObjectFactory(Collection<String> serverUris, Auth auth); protected  BulkProcessorObjectFactory(Collection<String> serverUris, Auth auth, ClientSettings clientSettings); @Override Collection<String> getServerList(); @Override TransportClient createClient(); @Override Function<BulkRequest, Boolean> createBatchListener(FailoverPolicy failoverPolicy); @Override Function<BulkRequest, Boolean> createFailureHandler(FailoverPolicy failover); @Override BatchOperations<BulkRequest> createBatchOperations(); @Override void execute(IndexTemplate indexTemplate); @Override void addOperation(Operation operation); @PluginBuilderFactory static Builder newBuilder();  }### Answer:
@Test public void secureTransportIsSetupByDefaultWhenAuthIsConfigured() { Builder builder = createTestObjectFactoryBuilder(); builder.withAuth(XPackAuthTest.createTestBuilder().build()); BulkProcessorObjectFactory factory = builder.build(); ClientProvider clientProvider = factory.getClientProvider(); Assert.assertTrue(clientProvider instanceof SecureClientProvider); }
@Test public void insecureTransportIsSetupByDefaultWhenAuthIsNotConfigured() { Builder builder = createTestObjectFactoryBuilder(); builder.withAuth(null); BulkProcessorObjectFactory factory = builder.build(); ClientProvider clientProvider = factory.getClientProvider(); Assert.assertTrue(clientProvider instanceof BulkProcessorObjectFactory.InsecureTransportClientProvider); }
@Test public void insecureTransportCanBeSetUpWithMinimalConstructor() { BulkProcessorObjectFactory factory = new BulkProcessorObjectFactory(Collections.singletonList(TEST_SERVER_URIS), null); ClientProvider clientProvider = factory.getClientProvider(); Assert.assertTrue(clientProvider instanceof BulkProcessorObjectFactory.InsecureTransportClientProvider); }
@Test public void secureTransportIsSetupByDefaultWhenAuthIsConfigured() { Builder builder = createTestObjectFactoryBuilder(); ShieldAuth auth = ShieldAuthTest.createTestBuilder().build(); builder.withAuth(auth); BulkProcessorObjectFactory factory = builder.build(); ClientProvider<TransportClient> clientProvider = factory.getClientProvider(); Assert.assertTrue(clientProvider instanceof SecureClientProvider); }