startNode("server1");
startNode("server2");
String server1NodeId = ((InternalNode) node("server1")).injector().getInstance(ClusterService.class).state().nodes().localNodeId();
String server2NodeId = ((InternalNode) node("server2")).injector().getInstance(ClusterService.class).state().nodes().localNodeId();
NodesInfoResponse response = client("server1").admin().cluster().prepareNodesInfo().execute().actionGet();
assertThat(response.nodes().length, equalTo(2));
assertThat(response.nodesMap().get(server1NodeId), notNullValue());
assertThat(response.nodesMap().get(server2NodeId), notNullValue());
response = client("server2").admin().cluster().nodesInfo(nodesInfoRequest()).actionGet();
assertThat(response.nodes().length, equalTo(2));
assertThat(response.nodesMap().get(server1NodeId), notNullValue());
assertThat(response.nodesMap().get(server2NodeId), notNullValue());
response = client("server1").admin().cluster().nodesInfo(nodesInfoRequest(server1NodeId)).actionGet();
assertThat(response.nodes().length, equalTo(1));
assertThat(response.nodesMap().get(server1NodeId), notNullValue());
response = client("server2").admin().cluster().nodesInfo(nodesInfoRequest(server1NodeId)).actionGet();
assertThat(response.nodes().length, equalTo(1));
assertThat(response.nodesMap().get(server1NodeId), notNullValue());
response = client("server1").admin().cluster().nodesInfo(nodesInfoRequest(server2NodeId)).actionGet();
assertThat(response.nodes().length, equalTo(1));
assertThat(response.nodesMap().get(server2NodeId), notNullValue());
response = client("server2").admin().cluster().nodesInfo(nodesInfoRequest(server2NodeId)).actionGet();
assertThat(response.nodes().length, equalTo(1));
assertThat(response.nodesMap().get(server2NodeId), notNullValue());
}