URLConnectionFactory { public static URLConnectionFactory newDefaultURLConnectionFactory( Configuration conf) { ConnectionConfigurator conn = getSSLConnectionConfiguration( DEFAULT_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT, conf); return new URLConnectionFactory(conn); } @VisibleForTesting  URLConnectionFactory(ConnectionConfigurator connConfigurator); static URLConnectionFactory newDefaultURLConnectionFactory(
      Configuration conf); static URLConnectionFactory newDefaultURLConnectionFactory(
      int connectTimeout, int readTimeout, Configuration conf); static URLConnectionFactory newOAuth2URLConnectionFactory(
      int connectTimeout, int readTimeout, Configuration conf); URLConnection openConnection(URL url); URLConnection openConnection(URL url, boolean isSpnego); void destroy(); final static int DEFAULT_SOCKET_TIMEOUT; static final URLConnectionFactory DEFAULT_SYSTEM_CONNECTION_FACTORY; }
@Test public void testSSLInitFailure() throws Exception { Configuration conf = new Configuration(); conf.set(SSLFactory.SSL_HOSTNAME_VERIFIER_KEY, "foo"); GenericTestUtils.LogCapturer logs = GenericTestUtils.LogCapturer.captureLogs( LoggerFactory.getLogger(URLConnectionFactory.class)); URLConnectionFactory.newDefaultURLConnectionFactory(conf); Assert.assertTrue("Expected log for ssl init failure not found!", logs.getOutput().contains( "Cannot load customized ssl related configuration")); }