@Test public void testGetProxy_NullSelector() throws Exception { RemoteRepository repo = new RemoteRepository.Builder( "test", "default", "http: java.net.ProxySelector.setDefault( null ); assertNull( selector.getProxy( repo ) ); }
public Proxy getProxy( RemoteRepository repository ) { List<java.net.Proxy> proxies = null; try { URI uri = new URI( repository.getUrl() ).parseServerAuthority(); proxies = java.net.ProxySelector.getDefault().select( uri ); } catch ( Exception e ) { } if ( proxies != null ) { for ( java.net.Proxy proxy : proxies ) { if ( java.net.Proxy.Type.DIRECT.equals( proxy.type() ) ) { break; } if ( java.net.Proxy.Type.HTTP.equals( proxy.type() ) && isValid( proxy.address() ) ) { InetSocketAddress addr = (InetSocketAddress) proxy.address(); return new Proxy( Proxy.TYPE_HTTP, addr.getHostName(), addr.getPort(), JreProxyAuthentication.INSTANCE ); } } } return null; }
JreProxySelector implements ProxySelector { public Proxy getProxy( RemoteRepository repository ) { List<java.net.Proxy> proxies = null; try { URI uri = new URI( repository.getUrl() ).parseServerAuthority(); proxies = java.net.ProxySelector.getDefault().select( uri ); } catch ( Exception e ) { } if ( proxies != null ) { for ( java.net.Proxy proxy : proxies ) { if ( java.net.Proxy.Type.DIRECT.equals( proxy.type() ) ) { break; } if ( java.net.Proxy.Type.HTTP.equals( proxy.type() ) && isValid( proxy.address() ) ) { InetSocketAddress addr = (InetSocketAddress) proxy.address(); return new Proxy( Proxy.TYPE_HTTP, addr.getHostName(), addr.getPort(), JreProxyAuthentication.INSTANCE ); } } } return null; } }
JreProxySelector implements ProxySelector { public Proxy getProxy( RemoteRepository repository ) { List<java.net.Proxy> proxies = null; try { URI uri = new URI( repository.getUrl() ).parseServerAuthority(); proxies = java.net.ProxySelector.getDefault().select( uri ); } catch ( Exception e ) { } if ( proxies != null ) { for ( java.net.Proxy proxy : proxies ) { if ( java.net.Proxy.Type.DIRECT.equals( proxy.type() ) ) { break; } if ( java.net.Proxy.Type.HTTP.equals( proxy.type() ) && isValid( proxy.address() ) ) { InetSocketAddress addr = (InetSocketAddress) proxy.address(); return new Proxy( Proxy.TYPE_HTTP, addr.getHostName(), addr.getPort(), JreProxyAuthentication.INSTANCE ); } } } return null; } JreProxySelector(); }
JreProxySelector implements ProxySelector { public Proxy getProxy( RemoteRepository repository ) { List<java.net.Proxy> proxies = null; try { URI uri = new URI( repository.getUrl() ).parseServerAuthority(); proxies = java.net.ProxySelector.getDefault().select( uri ); } catch ( Exception e ) { } if ( proxies != null ) { for ( java.net.Proxy proxy : proxies ) { if ( java.net.Proxy.Type.DIRECT.equals( proxy.type() ) ) { break; } if ( java.net.Proxy.Type.HTTP.equals( proxy.type() ) && isValid( proxy.address() ) ) { InetSocketAddress addr = (InetSocketAddress) proxy.address(); return new Proxy( Proxy.TYPE_HTTP, addr.getHostName(), addr.getPort(), JreProxyAuthentication.INSTANCE ); } } } return null; } JreProxySelector(); Proxy getProxy( RemoteRepository repository ); }
JreProxySelector implements ProxySelector { public Proxy getProxy( RemoteRepository repository ) { List<java.net.Proxy> proxies = null; try { URI uri = new URI( repository.getUrl() ).parseServerAuthority(); proxies = java.net.ProxySelector.getDefault().select( uri ); } catch ( Exception e ) { } if ( proxies != null ) { for ( java.net.Proxy proxy : proxies ) { if ( java.net.Proxy.Type.DIRECT.equals( proxy.type() ) ) { break; } if ( java.net.Proxy.Type.HTTP.equals( proxy.type() ) && isValid( proxy.address() ) ) { InetSocketAddress addr = (InetSocketAddress) proxy.address(); return new Proxy( Proxy.TYPE_HTTP, addr.getHostName(), addr.getPort(), JreProxyAuthentication.INSTANCE ); } } } return null; } JreProxySelector(); Proxy getProxy( RemoteRepository repository );  }