question: public void testEqualsDoesNotDoHostnameResolution ( ) throws Exception { for ( InetAddress inetAddress : InetAddress . getAllByName ( "localhost" ) ) { String address = inetAddress . getHostAddress ( ) ; if ( inetAddress instanceof Inet6Address ) { address = "[" + address + "]" ; } URL urlByHostName = new URL ( "http://localhost/foo?bar=baz#quux" ) ; URL urlByAddress = new URL ( "http://" + address + "/foo?bar=baz#quux" ) ; assertFalse ( "Expected " + urlByHostName + " to not equal " + urlByAddress , urlByHostName . equals ( urlByAddress ) ) ; } }
target:  Android's URL.equals() works as if the network is down. This is different from the RI, which does potentially slow and inconsistent DNS lookups in URL.equals.