ElasticSearchHost { public static HttpHost[] parse(String host) { String[] values = Strings.split(host, ','); HttpHost[] hosts = new HttpHost[values.length]; for (int i = 0; i < values.length; i++) { String value = values[i].strip(); hosts[i] = new HttpHost(value, 9200); } return hosts; }  static HttpHost[] parse(String host);  }
@Test void parse() { assertThat(ElasticSearchHost.parse("es-0")) .containsExactly(new HttpHost("es-0", 9200)); assertThat(ElasticSearchHost.parse("es-0, es-1")) .containsExactly(new HttpHost("es-0", 9200), new HttpHost("es-1", 9200)); }