### Question:
HttpProxyHandlerFactory implements ProxyHandlerFactory { public static HttpProxyHandlerFactory fromSystemProxies(final String apnsHost) throws URISyntaxException { final SocketAddress proxyAddress = getProxyAddressForUri(new URI("https", apnsHost, null, null)); return (proxyAddress != null) ? new HttpProxyHandlerFactory(proxyAddress, System.getProperty(PROXY_USERNAME_PROPERTY_KEY), System.getProperty(PROXY_PASSWORD_PROPERTY_KEY)) : null; } HttpProxyHandlerFactory(final SocketAddress proxyAddress);  HttpProxyHandlerFactory(final SocketAddress proxyAddress, final String username, final String password); static HttpProxyHandlerFactory fromSystemProxies(final String apnsHost); @Override ProxyHandler createProxyHandler(); @Override String toString();  }### Answer:
@Test void testNoProxy() throws URISyntaxException { ProxySelector.setDefault(new FixedProxiesSelector(Proxy.NO_PROXY)); assertNull(HttpProxyHandlerFactory.fromSystemProxies(ApnsClientBuilder.PRODUCTION_APNS_HOST)); assertNull(HttpProxyHandlerFactory.fromSystemProxies(ApnsClientBuilder.DEVELOPMENT_APNS_HOST)); }
@Test void testHasHttpProxy() throws URISyntaxException { ProxySelector.setDefault(new FixedProxiesSelector(DUMMY_HTTP_PROXY)); assertNotNull(HttpProxyHandlerFactory.fromSystemProxies(ApnsClientBuilder.PRODUCTION_APNS_HOST)); assertNotNull(HttpProxyHandlerFactory.fromSystemProxies(ApnsClientBuilder.DEVELOPMENT_APNS_HOST)); }
@Test void testHasSocksProxy() throws URISyntaxException { ProxySelector.setDefault(new FixedProxiesSelector(DUMMY_SOCKS_PROXY)); assertNull(HttpProxyHandlerFactory.fromSystemProxies(ApnsClientBuilder.PRODUCTION_APNS_HOST)); assertNull(HttpProxyHandlerFactory.fromSystemProxies(ApnsClientBuilder.DEVELOPMENT_APNS_HOST)); }
@Test void testHasSocksAndHttpProxies() throws URISyntaxException { ProxySelector.setDefault(new FixedProxiesSelector(DUMMY_HTTP_PROXY, DUMMY_SOCKS_PROXY)); assertNotNull(HttpProxyHandlerFactory.fromSystemProxies(ApnsClientBuilder.PRODUCTION_APNS_HOST)); assertNotNull(HttpProxyHandlerFactory.fromSystemProxies(ApnsClientBuilder.DEVELOPMENT_APNS_HOST)); }
@Test void testHasHttpProxyForApnsProductionOnly() throws URISyntaxException { ProxySelector.setDefault(new SingleHostHttpProxySelector(ApnsClientBuilder.PRODUCTION_APNS_HOST)); assertNotNull(HttpProxyHandlerFactory.fromSystemProxies(ApnsClientBuilder.PRODUCTION_APNS_HOST)); assertNull(HttpProxyHandlerFactory.fromSystemProxies(ApnsClientBuilder.DEVELOPMENT_APNS_HOST)); }
@Test void testHasHttpProxyForApnsDevelopmentOnly() throws URISyntaxException { ProxySelector.setDefault(new SingleHostHttpProxySelector(ApnsClientBuilder.DEVELOPMENT_APNS_HOST)); assertNull(HttpProxyHandlerFactory.fromSystemProxies(ApnsClientBuilder.PRODUCTION_APNS_HOST)); assertNotNull(HttpProxyHandlerFactory.fromSystemProxies(ApnsClientBuilder.DEVELOPMENT_APNS_HOST)); }