@Test
public void testValidateRequestSecureRequests() {

    ChangeLogStore structStore = new ZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root",
            privateKey, "0");
    DataStore store = new DataStore(structStore, null);
    
    ZTSImpl ztsImpl = new ZTSImpl(mockCloudStore, store);
    ztsImpl.secureRequestsOnly = false;
    ztsImpl.statusPort = 0;
    
    HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
    Mockito.when(request.isSecure()).thenReturn(true);
    
    // if secure requests is false, no check is done
    
    ztsImpl.validateRequest(request, "principal-domain", "test");
    ztsImpl.validateRequest(request, "principal-domain", "test", false);
    ztsImpl.validateRequest(request, "principal-domain", "test", true);
    
    // should complete successfully since our request is true
    
    ztsImpl.secureRequestsOnly = true;
    ztsImpl.validateRequest(request, "principal-domain", "test");
    ztsImpl.validateRequest(request, "principal-domain", "test", false);
    ztsImpl.validateRequest(request, "principal-domain", "test", true);
}