### Question:
ElasticConnection { public static Builder builder() { return new Builder(); } private  ElasticConnection(BulkProcessor processor, RestHighLevelClient restHighLevelClient, RestClientBuilder restClient); static Builder builder(); RestHighLevelClient getRestHighLevelClient(); BulkProcessor getProcessor(); static ElasticConnection getConnection(String hostname); static ElasticConnection getConnection(String hostname, int restPort, String restScheme); void close();  }### Answer:
@Test public void testBuilder() { BulkProcessor.Listener listener = new BulkProcessor.Listener() { @Override public void afterBulk(long executionId, BulkRequest request, BulkResponse response) { for (BulkItemResponse item : response.getItems()) { if (item.isFailed()) { LOG.error("Bulk item failure: '{}' for request '{}'", item.getFailure(), request.requests().get(item.getItemId())); } } } @Override public void afterBulk(long executionId, BulkRequest request, Throwable response) { LOG.error("Bulk failed:" + response); } @Override public void beforeBulk(long executionId, BulkRequest request) { for (DocWriteRequest r :request.requests()) { try { if (r instanceof IndexRequest) { IndexRequest indexRequest = (IndexRequest) r; indexRequest.id(URLDecoder.decode(indexRequest.id(), "utf-8")); } else if (r instanceof UpdateRequest) { UpdateRequest updateRequest = (UpdateRequest) r; updateRequest.id(URLDecoder.decode(updateRequest.id(), "utf-8")); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } } }; ElasticConnection connection = ElasticConnection.builder() .hostname("0.0.0.0") .restPort(443) .restScheme("https") .bulkActions(1) .flushIntervalString("1s") .listener(listener) .build(); assertNotNull(connection); }