@Test
public void testValidateRequestNonSecureRequests() {

    ZMSImpl zmsImpl = zmsInit();
    zmsImpl.secureRequestsOnly = true;
    zmsImpl.statusPort = 0;
    
    HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
    
    // if request is not secure, should be rejected
    
    Mockito.when(request.isSecure()).thenReturn(false);
    try {
        zmsImpl.validateRequest(request, "test");
        fail();
    } catch (ResourceException ignored) {
    }
    try {
        zmsImpl.validateRequest(request, "test", false);
        fail();
    } catch (ResourceException ignored) {
    }
    try {
        zmsImpl.validateRequest(request, "test", true);
        fail();
    } catch (ResourceException ignored) {
    }
    zmsImpl.objectStore.clearConnections();
}