carterkozak commented on a change in pull request #279:
URL:
https://github.com/apache/httpcomponents-core/pull/279#discussion_r615423742
##########
File path: httpcore5/src/test/java/org/apache/hc/core5/net/TestHost.java
##########
@@ -129,4 +129,31 @@ public void testCreateFromStringInvalid() throws Exception
{
}
}
+ @Test
+ public void testIpv6HostAndPort() throws Exception {
+ final Host host = Host.create("[::1]:80");
+ Assert.assertEquals("::1", host.getHostName());
+ Assert.assertEquals(80, host.getPort());
+ }
+
+ @Test
+ public void testIpv6HostAndPortWithoutBrackets() {
+ try {
+ // ambiguous
+ Host.create("::1:80");
+ Assert.fail("IllegalArgumentException expected");
+ } catch (final URISyntaxException expected) {
+ Assert.assertTrue(expected.getMessage().contains("Expected IPv6
address to be enclosed in brackets"));
+ }
+ }
+
+ @Test
+ public void testIpv6HostWithoutPort() {
+ try {
+ Host.create("::1");
+ Assert.fail("IllegalArgumentException expected");
Review comment:
this test and the test above it reference the wrong exception type in
the failure message -- updating
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]