APISonar


org.elasticsearch.client.sniff.ElasticsearchNodesSniffer.Scheme.HTTP

> org > elasticsearch > client > sniff > ElasticsearchNodesSniffer > Scheme > HTTP
org APIs elasticsearch APIs client APIs sniff APIs ElasticsearchNodesSniffer APIs Scheme APIs HTTP APIs

Example 1
public void testParsingPublishAddressWithPreES7Format() throws IOException {
        InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("es6_nodes_publication_address_format.json");

        HttpEntity entity = new InputStreamEntity(in, ContentType.APPLICATION_JSON);
        List<Node> nodes = ElasticsearchNodesSniffer.readHosts(entity, Scheme.HTTP, new JsonFactory());

        assertEquals("127.0.0.1", nodes.get(0).getHost().getHostName());
        assertEquals(9200, nodes.get(0).getHost().getPort());
        assertEquals("http", nodes.get(0).getHost().getSchemeName());
    }