RestElasticClient implements ElasticClient { @Override public void close() throws IOException { LOGGER.fine("Closing proxyClient: " + this.client); try { this.client.close(); } finally { if (this.proxyClient != null) { LOGGER.fine("Closing proxyClient: " + this.proxyClient); this.proxyClient.close(); } } } RestElasticClient(RestClient client);  RestElasticClient(RestClient client, RestClient proxyClient, boolean enableRunAs); @Override double getVersion(); @Override List<String> getTypes(String indexName); @Override Map<String, Object> getMapping(String indexName, String type); @Override ElasticResponse search(String searchIndices, String type, ElasticRequest request); @Override ElasticResponse scroll(String scrollId, Integer scrollTime); @Override void clearScroll(Set<String> scrollIds); @Override void close(); @SuppressWarnings("unchecked") static void removeMapping(String parent, String key, Map<String,Object> data, String currentParent);  }
@Test public void testClose() throws IOException { client.close(); verify(mockRestClient).close(); }
@Test public void testCloseWithProxyClient() throws IOException { proxyClient.close(); verify(mockRestClient).close(); verify(mockProxyRestClient).close(); }