code: public static List<InetSocketAddress> getRPCAddresses(String suffix,
        Configuration conf, Collection<String> serviceIds, String... keys) 
            throws IOException {
      // Use default address as fall back
      String defaultAddress = null;
      try {
        defaultAddress = conf.get(FileSystem.FS_DEFAULT_NAME_KEY + suffix);
        if (defaultAddress != null) {
          defaultAddress = NameNode.getDefaultAddress(conf);
        }
      } catch (IllegalArgumentException e) {
        defaultAddress = null;
      }
      
      for (int i = 0; i < keys.length; i++) {
        keys[i] += suffix;
      }
      
      List<InetSocketAddress> addressList = DFSUtil.getAddresses(conf,
          serviceIds, defaultAddress,
          keys);
      if (addressList == null) {
        String keyStr = "";
        for (String key: keys) {
          keyStr += key + " ";
        }
        throw new IOException("Incorrect configuration: namenode address "
            + keyStr
            + " is not configured.");
      }
      return addressList;
    }
docs: Returns list of InetSocketAddresses corresponding to namenodes from the
  configuration.
  @param suffix 0 or 1 indicating if this is AN0 or AN1
  @param conf configuration
  @param keys Set of keys
  @return list of InetSocketAddress
  @throws IOException on error