assertTrue("Wild should imply normal", star_All.implies(www_All));
assertTrue("Normal shouldn't imply wildcard", !www_All
.implies(star_Resolve));
assertTrue("Resolve shouldn't imply all", !star_Resolve
.implies(star_All));
SocketPermission p1 = new SocketPermission(wwwName + ":80-81",
"connect");
SocketPermission p2 = new SocketPermission(wwwName + ":80", "connect");
assertTrue("Port 80 is implied by 80-81", p1.implies(p2));
p1 = new SocketPermission(wwwName + ":79-80", "connect");
assertTrue("Port 80 is implied by 79-80", p1.implies(p2));
p1 = new SocketPermission(wwwName + ":79-81", "connect");
assertTrue("Port 80 is implied by 79-81", p1.implies(p2));
p2 = new SocketPermission(wwwName + ":79-80", "connect");
assertTrue("Port 79-80 is implied by 79-81", p1.implies(p2));
p2 = new SocketPermission(wwwName, "resolve");
assertTrue(
"Any identical host should imply resolve regardless of the ports",
p1.implies(p2));
SocketPermission sp1 = new SocketPermission("www.Ibm.com", "resolve");
SocketPermission sp2 = new SocketPermission("www.IBM.com", "resolve");
assertTrue("SocketPermission is case sensitive", sp1.implies(sp2));
SocketPermission sp3 = new SocketPermission("*.ibm.com", "resolve");
assertTrue("SocketPermission wildcard is case sensitive", sp3
.implies(sp2));
InetAddress host = null;
try {
host = InetAddress.getByName(Support_Configuration.UnresolvedIP);
} catch (UnknownHostException e) {
}
SocketPermission perm1 = new SocketPermission(
Support_Configuration.UnresolvedIP, "connect");
SocketPermission perm2 = new SocketPermission(
Support_Configuration.UnresolvedIP + ":80", "connect");
assertTrue("should imply port 80", perm1.implies(perm2));
PermissionCollection col = perm1.newPermissionCollection();
col.add(perm1);
assertTrue("collection should imply port 80", col.implies(perm2));