@Test
 public void getServerPortViaHostHeaderWithPort() {
   String testServer = "test.server";
   int testPort = 9999;
   request.addHeader(HOST, testServer + ":" + testPort);
   assertEquals(testPort, request.getServerPort());
 }
 @Test
 public void getServerPortViaHostHeaderAsIpv6AddressWithPort() {
   String testServer = "[2001:db8:0:1]";
   int testPort = 9999;
   request.addHeader(HOST, testServer + ":" + testPort);
   assertEquals(testPort, request.getServerPort());
 }
 @Test
 public void contentTypeHeaderUTF8() {
   String contentType = "test/plain;charset=UTF-8";
   request.addHeader("Content-Type", contentType);
   assertEquals(contentType, request.getContentType());
   assertEquals(contentType, request.getHeader("Content-Type"));
   assertEquals("UTF-8", request.getCharacterEncoding());
 }
 @Test
 public void contentTypeHeader() {
   String contentType = "test/plain";
   request.addHeader("Content-Type", contentType);
   assertEquals(contentType, request.getContentType());
   assertEquals(contentType, request.getHeader("Content-Type"));
   assertNull(request.getCharacterEncoding());
 }
 @Test
 public void httpHeaderNameCasingIsPreserved() throws Exception {
   String headerName = "Header1";
   request.addHeader(headerName, "value1");
   Enumeration<String> requestHeaders = request.getHeaderNames();
   assertNotNull(requestHeaders);
   assertEquals(
       "HTTP header casing not being preserved", headerName, requestHeaders.nextElement());
 }
 @Test
 public void getServerPortViaHostHeaderWithoutPort() {
   String testServer = "test.server";
   request.addHeader(HOST, testServer);
   assertEquals(80, request.getServerPort());
 }
 @Test
 public void getServerPortViaHostHeaderAsIpv6AddressWithoutPort() {
   String testServer = "[2001:db8:0:1]";
   request.addHeader(HOST, testServer);
   assertEquals(80, request.getServerPort());
 }
 @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 getServerNameViaHostHeaderWithPort() {
   String testServer = "test.server";
   request.addHeader(HOST, testServer + ":8080");
   assertEquals(testServer, request.getServerName());
 }