### Question:
DFSUtil { public static String getInfoServer( InetSocketAddress namenode, Configuration conf, boolean httpsAddress) { String httpAddress = null; String httpAddressKey = (UserGroupInformation.isSecurityEnabled() && httpsAddress) ? DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_KEY : DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY; String httpAddressDefault = (UserGroupInformation.isSecurityEnabled() && httpsAddress) ? DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_DEFAULT : DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_DEFAULT; if(namenode != null) { String nameServiceId = DFSUtil.getNameServiceIdFromAddress( conf, namenode, DFSConfigKeys.DFS_NAMENODE_SERVICE_RPC_ADDRESS_KEY, DFSConfigKeys.DFS_NAMENODE_RPC_ADDRESS_KEY); if (nameServiceId != null) { httpAddress = conf.get(DFSUtil.getNameServiceIdKey( httpAddressKey, nameServiceId)); } } if (httpAddress == null) { httpAddress = conf.get(httpAddressKey, httpAddressDefault); } return httpAddress; }  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 testGetServerInfo(){ HdfsConfiguration conf = new HdfsConfiguration(); conf.set(HADOOP_SECURITY_AUTHENTICATION, "kerberos"); UserGroupInformation.setConfiguration(conf); String httpsport = DFSUtil.getInfoServer(null, conf, true); Assert.assertEquals("0.0.0.0:50470", httpsport); String httpport = DFSUtil.getInfoServer(null, conf, false); Assert.assertEquals("0.0.0.0:50070", httpport); }