public void testFromStringUnparseableNonsense() { // Some nonsense that causes parse failures. checkFromStringCase("[goo.gl]", 1, null, 99, false); checkFromStringCase("[goo.gl]:80", 1, null, 99, false); checkFromStringCase("[", 1, null, 99, false); checkFromStringCase("[]:", 1, null, 99, false); checkFromStringCase("[]:80", 1, null, 99, false); checkFromStringCase("[]bad", 1, null, 99, false); }
public void testFromStringBadDefaultPort() { // Well-formed strings with bad default ports. checkFromStringCase("gmail.com:81", -1, "gmail.com", 81, true); checkFromStringCase("192.0.2.2:83", -1, "192.0.2.2", 83, true); checkFromStringCase("[2001::2]:85", -1, "2001::2", 85, true); checkFromStringCase("goo.gl:65535", 65536, "goo.gl", 65535, true); // No port, bad default. checkFromStringCase("google.com", -1, "google.com", -1, false); checkFromStringCase("192.0.2.1", 65536, "192.0.2.1", -1, false); checkFromStringCase("[2001::1]", -1, "2001::1", -1, false); checkFromStringCase("2001::3", 65536, "2001::3", -1, false); }
public void testFromStringUnusedDefaultPort() { // Default port, but unused. checkFromStringCase("gmail.com:81", 77, "gmail.com", 81, true); checkFromStringCase("192.0.2.2:83", 77, "192.0.2.2", 83, true); checkFromStringCase("[2001::2]:85", 77, "2001::2", 85, true); }
public void testFromStringBadPort() { // Out-of-range ports. checkFromStringCase("google.com:65536", 1, null, 99, false); checkFromStringCase("google.com:9999999999", 1, null, 99, false); // Invalid port parts. checkFromStringCase("google.com:port", 1, null, 99, false); checkFromStringCase("google.com:-25", 1, null, 99, false); checkFromStringCase("google.com:+25", 1, null, 99, false); checkFromStringCase("google.com:25 ", 1, null, 99, false); checkFromStringCase("google.com:25\t", 1, null, 99, false); checkFromStringCase("google.com:0x25 ", 1, null, 99, false); }
public void testFromStringParseableNonsense() { // Examples of nonsense that gets through. checkFromStringCase("[[:]]", 86, "[:]", 86, false); checkFromStringCase("x:y:z", 87, "x:y:z", 87, false); checkFromStringCase("", 88, "", 88, false); checkFromStringCase(":", 99, "", 99, false); checkFromStringCase(":123", -1, "", 123, true); checkFromStringCase("\nOMG\t", 89, "\nOMG\t", 89, false); }
public void testFromStringWellFormed() { // Well-formed inputs. checkFromStringCase("google.com", 80, "google.com", 80, false); checkFromStringCase("google.com", 80, "google.com", 80, false); checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false); checkFromStringCase("[2001::1]", 84, "2001::1", 84, false); checkFromStringCase("2001::3", 86, "2001::3", 86, false); checkFromStringCase("host:", 80, "host", 80, false); }
public void testFromStringUnusedDefaultPort() { // Default port, but unused. checkFromStringCase("gmail.com:81", 77, "gmail.com", 81, true); checkFromStringCase("192.0.2.2:83", 77, "192.0.2.2", 83, true); checkFromStringCase("[2001::2]:85", 77, "2001::2", 85, true); }
public void testFromStringUnparseableNonsense() { // Some nonsense that causes parse failures. checkFromStringCase("[goo.gl]", 1, null, 99, false); checkFromStringCase("[goo.gl]:80", 1, null, 99, false); checkFromStringCase("[", 1, null, 99, false); checkFromStringCase("[]:", 1, null, 99, false); checkFromStringCase("[]:80", 1, null, 99, false); checkFromStringCase("[]bad", 1, null, 99, false); }
public void testFromStringBadDefaultPort() { // Well-formed strings with bad default ports. checkFromStringCase("gmail.com:81", -1, "gmail.com", 81, true); checkFromStringCase("192.0.2.2:83", -1, "192.0.2.2", 83, true); checkFromStringCase("[2001::2]:85", -1, "2001::2", 85, true); checkFromStringCase("goo.gl:65535", 65536, "goo.gl", 65535, true); // No port, bad default. checkFromStringCase("google.com", -1, "google.com", -1, false); checkFromStringCase("192.0.2.1", 65536, "192.0.2.1", -1, false); checkFromStringCase("[2001::1]", -1, "2001::1", -1, false); checkFromStringCase("2001::3", 65536, "2001::3", -1, false); }
public void testFromStringWellFormed() { // Well-formed inputs. checkFromStringCase("google.com", 80, "google.com", 80, false); checkFromStringCase("google.com", 80, "google.com", 80, false); checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false); checkFromStringCase("[2001::1]", 84, "2001::1", 84, false); checkFromStringCase("2001::3", 86, "2001::3", 86, false); checkFromStringCase("host:", 80, "host", 80, false); }
public void testFromStringBadPort() { // Out-of-range ports. checkFromStringCase("google.com:65536", 1, null, 99, false); checkFromStringCase("google.com:9999999999", 1, null, 99, false); // Invalid port parts. checkFromStringCase("google.com:port", 1, null, 99, false); checkFromStringCase("google.com:-25", 1, null, 99, false); checkFromStringCase("google.com:+25", 1, null, 99, false); checkFromStringCase("google.com:25 ", 1, null, 99, false); checkFromStringCase("google.com:25\t", 1, null, 99, false); checkFromStringCase("google.com:0x25 ", 1, null, 99, false); }
public void testFromStringParseableNonsense() { // Examples of nonsense that gets through. checkFromStringCase("[[:]]", 86, "[:]", 86, false); checkFromStringCase("x:y:z", 87, "x:y:z", 87, false); checkFromStringCase("", 88, "", 88, false); checkFromStringCase(":", 99, "", 99, false); checkFromStringCase(":123", -1, "", 123, true); checkFromStringCase("\nOMG\t", 89, "\nOMG\t", 89, false); }