### Question:
BaseHttpServer { protected InetSocketAddress getBindAddress(String bindHostKey, String addressKey, String bindHostDefault, int bindPortdefault) { final Optional<String> bindHost = getHostNameFromConfigKeys(conf, bindHostKey); final OptionalInt addressPort = getPortNumberFromConfigKeys(conf, addressKey); final Optional<String> addressHost = getHostNameFromConfigKeys(conf, addressKey); String hostName = bindHost.orElse(addressHost.orElse(bindHostDefault)); return NetUtils.createSocketAddr( hostName + ":" + addressPort.orElse(bindPortdefault)); } BaseHttpServer(MutableConfigurationSource conf, String name); static HttpServer2.Builder newHttpServer2BuilderForOzone(
      MutableConfigurationSource conf, final InetSocketAddress httpAddr,
      final InetSocketAddress httpsAddr, String name); InetSocketAddress getHttpsBindAddress(); InetSocketAddress getHttpBindAddress(); void start(); void stop(); void updateConnectorAddress(); static HttpServer2.Builder loadSslConfToHttpServerBuilder(
      HttpServer2.Builder builder, ConfigurationSource sslConf); static ConfigurationSource loadSslConfiguration(
      ConfigurationSource conf); InetSocketAddress getHttpAddress(); InetSocketAddress getHttpsAddress();  }### Answer:
@Test public void getBindAddress() throws Exception { OzoneConfiguration conf = new OzoneConfiguration(); conf.set("enabled", "false"); BaseHttpServer baseHttpServer = new BaseHttpServer(conf, "test") { @Override protected String getHttpAddressKey() { return null; } @Override protected String getHttpsAddressKey() { return null; } @Override protected String getHttpBindHostKey() { return null; } @Override protected String getHttpsBindHostKey() { return null; } @Override protected String getBindHostDefault() { return null; } @Override protected int getHttpBindPortDefault() { return 0; } @Override protected int getHttpsBindPortDefault() { return 0; } @Override protected String getKeytabFile() { return null; } @Override protected String getSpnegoPrincipal() { return null; } @Override protected String getEnabledKey() { return "enabled"; } @Override protected String getHttpAuthType() { return "simple"; } @Override protected String getHttpAuthConfigPrefix() { return null; } }; conf.set("addresskey", "0.0.0.0:1234"); Assert.assertEquals("/0.0.0.0:1234", baseHttpServer .getBindAddress("bindhostkey", "addresskey", "default", 65).toString()); conf.set("bindhostkey", "1.2.3.4"); Assert.assertEquals("/1.2.3.4:1234", baseHttpServer .getBindAddress("bindhostkey", "addresskey", "default", 65).toString()); }