public void S3_RemoveApplication_NotPublished_Fail()
        {
            // remove the published application
            ServerDataModel.ResetPublishedEndpoint();
            // trigger the client to remove an application asynchronously
            // so that it does not block the main thread
            var sut = AsyncSutAdapter.TriggerRemoveApplicationAsync();

            TestSite.Log.Add(LogEntryKind.Comment, "Triggering proxy client to remove a web application");

            // start receiving client request
            // when request comes, forward it to the corresponding handler
            while ((CurrentRequest = ClientAdapter.ExpectRequest()) != null)
            {
                TestSite.Log.Add(LogEntryKind.Comment, "Received request for " + CurrentRequest.RequestUri.AbsolutePath);

                CurrentHandler = (ProxyRequestHandlerBase)Factory.GetRequestHandler(CurrentRequest);
                TestSite.Assert.IsTrue(CurrentHandler.VerifyRequest(out VerifyMessage), VerifyMessage);

                if (CurrentHandler is DeleteProxyPublishSettingsRequestHandler)
                {
                    CurrentResponse = ((DeleteProxyPublishSettingsRequestHandler)CurrentHandler)
                                      .GetNotFoundResponse();
                }
                else
                {
                    CurrentResponse = CurrentHandler.GetResponse();
                }

                ClientAdapter.SendResponse(CurrentResponse);
                TestSite.Log.Add(LogEntryKind.Comment, "Response has been sent to the client.");
            }

            TestSite.Assert.IsFalse(sut.Result.Return, "Client acted correctly with 404 response.");
        }
        protected override void TestInitialize()
        {
            base.TestInitialize();

            // register request handlers used by this test class
            Factory.RegisterRequestHandler <PostProxyPublishSettingsRequestHandler>();

            // make sure the application proxy is installed on the client
            TestSite.Assert.IsTrue(SutAdapter.IsApplicationProxyConfigured(),
                                   "Application proxy must be configured before publishing applications");

            // remove all published applications
            ServerDataModel.ResetPublishedEndpoint();
        }
        public void S6_ActiveClientAuth_AccessDenied()
        {
            ServerDataModel.ResetPublishedEndpoint();
            TestSite.Log.Add(LogEntryKind.Comment, "Reset Published Endpoint");
            System.Threading.Thread.Sleep(1000 * 30);
            // make a request to the proxy with authToken
            var sut = AsyncSutAdapter.TriggerPublishNonClaimsAppAsync();

            TestSite.Log.Add(LogEntryKind.Comment, "Triggering proxy client to publish a web application");

            System.Threading.Thread.Sleep(1000 * 60);

            TestSite.Log.Add(LogEntryKind.Comment, "Client start to access webapp");

            System.Threading.Thread.Sleep(1000 * 60);

            // make a request to the proxy with authToken
            var client = MockClient.MakeWebRequestWithBasicAuth(new Uri(EnvironmentConfig.App2Url),
                                                                ServerDataModel.GetIncorrectBasicAuthorizationHeader());

            TestSite.Assert.IsTrue(client.StatusCode == HttpStatusCode.Unauthorized, "Preauthenticated request failed redirected as access denied.");
        }