### Question:
DFSUtil { public static boolean isDefaultNamenodeAddress(Configuration conf, InetSocketAddress address, String... keys) { for (String key : keys) { String candidateAddress = conf.get(key); if (candidateAddress != null && address.equals(NetUtils.createSocketAddr(candidateAddress))) return true; } return false; }  static Random getRandom(); static boolean isValidName(String src); static String bytes2String(byte[] bytes); static byte[] string2Bytes(String str); static String byteArray2String(byte[][] pathComponents); static byte[][] bytes2byteArray(byte[] bytes, byte separator); static byte[][] bytes2byteArray(byte[] bytes,
                                         int len,
                                         byte separator); static BlockLocation[] locatedBlocks2Locations(LocatedBlocks blocks); static Collection<String> getNameServiceIds(Configuration conf); static List<InetSocketAddress> getBackupNodeAddresses(
      Configuration conf); static List<InetSocketAddress> getSecondaryNameNodeAddresses(
      Configuration conf); static List<InetSocketAddress> getNNServiceRpcAddresses(
      Configuration conf); static String getNameServiceIdFromAddress(Configuration conf, 
      InetSocketAddress address, String... keys); static String getInfoServer(
      InetSocketAddress namenode, Configuration conf, boolean httpsAddress); static boolean isDefaultNamenodeAddress(Configuration conf,
      InetSocketAddress address, String... keys); static String getNameServiceIdKey(String key, String nameserviceId); static void setGenericConf(Configuration conf,
      String nameserviceId, String... keys); static String getNameServiceId(Configuration conf); static float getPercentUsed(long used, long capacity); static float getPercentRemaining(long remaining, long capacity); static InetSocketAddress getSocketAddress(String address); static int roundBytesToGB(long bytes); static ClientProtocol createNamenode(Configuration conf); static ClientProtocol createNamenode( InetSocketAddress nameNodeAddr,
      Configuration conf); static ClientDatanodeProtocol createClientDatanodeProtocolProxy(
      DatanodeID datanodeid, Configuration conf, int socketTimeout,
      LocatedBlock locatedBlock); static final Comparator<DatanodeInfo> DECOM_COMPARATOR; }### Answer:
@Test public void testSingleNamenode() { HdfsConfiguration conf = new HdfsConfiguration(); final String DEFAULT_ADDRESS = "localhost:9000"; final String NN2_ADDRESS = "localhost:9001"; conf.set(DFSConfigKeys.DFS_NAMENODE_RPC_ADDRESS_KEY, DEFAULT_ADDRESS); InetSocketAddress testAddress1 = NetUtils.createSocketAddr(DEFAULT_ADDRESS); boolean isDefault = DFSUtil.isDefaultNamenodeAddress(conf, testAddress1, DFSConfigKeys.DFS_NAMENODE_SERVICE_RPC_ADDRESS_KEY, DFSConfigKeys.DFS_NAMENODE_RPC_ADDRESS_KEY); assertTrue(isDefault); InetSocketAddress testAddress2 = NetUtils.createSocketAddr(NN2_ADDRESS); isDefault = DFSUtil.isDefaultNamenodeAddress(conf, testAddress2, DFSConfigKeys.DFS_NAMENODE_SERVICE_RPC_ADDRESS_KEY, DFSConfigKeys.DFS_NAMENODE_RPC_ADDRESS_KEY); assertFalse(isDefault); }