@Test
public void testDefaultNamenode() throws IOException {

  HdfsConfiguration conf = new HdfsConfiguration();
  final String hdfs_default = "hdfs://localhost:9999/";
  conf.set(FS_DEFAULT_NAME_KEY, hdfs_default);
  // If DFS_FEDERATION_NAMESERVICES is not set, verify that
  // default namenode address is returned.
  Map<String, Map<String, InetSocketAddress>> addrMap =
    DFSUtil.getNNServiceRpcAddresses(conf);
  assertEquals(1, addrMap.size());
  
  Map<String, InetSocketAddress> defaultNsMap = addrMap.get(null);
  assertEquals(1, defaultNsMap.size());
  
  assertEquals(9999, defaultNsMap.get(null).getPort());
}