@Test public void getServerNameViaHostHeaderAsIpv6AddressWithPort() { String ipv6Address = "[2001:db8:0:1]:8081"; request.addHeader(HOST, ipv6Address); assertEquals("2001:db8:0:1", request.getServerName()); }
@Test public void getServerNameWithCustomName() { request.setServerName("example.com"); assertEquals("example.com", request.getServerName()); }
@Test public void getServerNameViaHostHeaderWithPort() { String testServer = "test.server"; request.addHeader(HOST, testServer + ":8080"); assertEquals(testServer, request.getServerName()); }
@Test public void getServerNameWithDefaultName() { assertEquals("localhost", request.getServerName()); }