ProxyHelper { static boolean isHostMatchesNonProxyHostsPattern( String host, String nonProxyHostsPattern ) { boolean matches = true; if ( StringUtils.isNotBlank( nonProxyHostsPattern ) ) { try { matches = host.matches( nonProxyHostsPattern ); } catch ( PatternSyntaxException e ) { String message = String.format( "Invalid pattern for non-proxy hosts: '%s'", nonProxyHostsPattern ); log.warn( message, e ); matches = false; } } String format = "isHostMatchesNonProxyHostsPattern( host = '{}', nonProxyHostsPattern = '{}' ): {}"; log.debug( format, host, nonProxyHostsPattern, matches ); return matches; } private  ProxyHelper(  ); static Proxy getProxy( String url ); static final String DEFAULT_PROTOCOL; }
@Test public void testIsHostMatchesNonProxyHostsPattern( ) { String javaPattern = ProxyHelper.convertToJavaPattern( PATTERN ); boolean matches = ProxyHelper.isHostMatchesNonProxyHostsPattern( HOST, javaPattern ); String message = String.format( "host '%s' must match pattern '%s'", HOST, PATTERN ); assertTrue( message, matches ); }