public static void main(String args[]) throws Exception { int errorCnt = 0; URL url1 = new URL("ftp://he@host/file#ref"); URL url2 = new URL("ftp://she@host/file#ref"); if (url1.equals(url2)) { throw new RuntimeException("URLStreamHandler.equals failure."); } else { System.out.println("Success."); } }