code: public synchronized Node masterNode() {
          final ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState();
          final String name = state.nodes().getMasterNode().getName();
          return getNode(name);
      }
docs: Return a master node.
  
  @return master node