@Test
 public void isSecureWithHttpSchemeAndSecureFlagIsFalse() {
   assertFalse(request.isSecure());
   request.setScheme("http");
   request.setSecure(false);
   assertFalse(request.isSecure());
 }
 @Test
 public void isSecureWithHttpsSchemeAndSecureFlagIsTrue() {
   assertFalse(request.isSecure());
   request.setScheme("https");
   request.setSecure(true);
   assertTrue(request.isSecure());
 }
  private MockHttpServletRequest newMockRequest(
      String method, String requestUri, String host, int port) {
    MockHttpServletRequest req = new MockHttpServletRequest(method, requestUri);
    req.setRemoteHost(host);
    req.setContentType("application/x-www-form-urlencoded");
    req.setRemotePort(port);
    if (port == 443) {
      req.setScheme("https");
      req.setSecure(true);
    } else {
      req.setScheme("http");
      req.setSecure(false);
    }

    return req;
  }