public static Configuration readSSLConfiguration(Configuration conf,
                                                   Mode mode) {
    Configuration sslConf = new Configuration(false);
    sslConf.setBoolean(SSL_REQUIRE_CLIENT_CERT_KEY, conf.getBoolean(
        SSL_REQUIRE_CLIENT_CERT_KEY, SSL_REQUIRE_CLIENT_CERT_DEFAULT));
    String sslConfResource;
    if (mode == Mode.CLIENT) {
      sslConfResource = conf.get(SSL_CLIENT_CONF_KEY,
          SSL_CLIENT_CONF_DEFAULT);
    } else {
      sslConfResource = conf.get(SSL_SERVER_CONF_KEY,
          SSL_SERVER_CONF_DEFAULT);
    }
    sslConf.addResource(sslConfResource);
    // Only fallback to input config if classpath SSL config does not load for
    // backward compatibility.
    if (sslConf.getResource(sslConfResource) == null) {
      LOG.debug("{} can't be loaded form classpath, fallback using SSL" +
          " config from input configuration.", sslConfResource);
      sslConf = conf;
    }
    return sslConf;
  }
@Test
  public void testNonExistSslClientXml() throws Exception{
    Configuration conf = new Configuration(false);
    conf.setBoolean(SSL_REQUIRE_CLIENT_CERT_KEY, false);
    conf.set(SSL_CLIENT_CONF_KEY, "non-exist-ssl-client.xml");
    Configuration sslConf =
        SSLFactory.readSSLConfiguration(conf, SSLFactory.Mode.CLIENT);
    assertNull(sslConf.getResource("non-exist-ssl-client.xml"));
    assertNull(sslConf.get("ssl.client.truststore.location"));
  }