// returns number of bytes read/written private static int DoIORequest(ConcurrentQueue <SerialStreamIORequest> q, RequestProcessor op) { // assumes dequeue-ing happens on a single thread while (q.TryPeek(out SerialStreamIORequest r)) { if (r.IsCompleted) { q.TryDequeue(out _); // take another item since we haven't processed anything continue; } int ret = op(r); Debug.Assert(ret >= 0); if (r.IsCompleted) { q.TryDequeue(out _); } return(ret); } return(0); }
static void DispatchRequest(ListenerLink link, Message message, DeliveryState deliveryState, object state) { RequestProcessor thisPtr = (RequestProcessor)state; ListenerLink responseLink = null; if (message.Properties != null || message.Properties.ReplyTo != null) { thisPtr.responseLinks.TryGetValue(message.Properties.ReplyTo, out responseLink); } Outcome outcome; if (responseLink == null) { outcome = new Rejected() { Error = new Error(ErrorCode.NotFound) { Description = "Not response link was found. Ensure the link is attached or reply-to is set on the request." } }; } else { outcome = new Accepted(); } link.DisposeMessage(message, outcome, true); RequestContext context = new RequestContext(link, responseLink, message); thisPtr.processor.Process(context); }
public void Can_Process_Non_Post_Request(string requestListing) { var request = requestListing + "\r\n" + "Host: localhost:8080\r\n" + "Connection: keep-alive\r\n" + "Content-Length: 33\r\n" + "Cache-Control: max-age = 0\r\n" + "Accept: text / html,application / xhtml + xml,application / xml; q = 0.9,image / webp,*/*;q=0.8\r\n" + "Origin: http://localhost:8080\r\n" + "Upgrade-Insecure-Requests: 1\r\n" + "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36\r\n" + "Content-Type: application/JSON\r\n" + "Referer: http://localhost:8080/form\r\n" + "Accept-Encoding: gzip, deflate\r\n" + "Accept-Language: en-US,en;q=0.8\r\n\r\n"; var zSocket = new MockZSocket().StubReceive("") .StubSentToReturn(10) .StubConnect(true); zSocket = zSocket.StubAcceptObject(zSocket); var properties = new ServerProperties(@"Home", 8080, new ServerTime(), new MockPrinter()); var process = new RequestProcessor(); var status = process.HandleRequest(request, zSocket, new MockHttpService() .StubProcessRequest("200 OK"), properties, new HttpResponse(zSocket)); Assert.Equal("200 OK", status); zSocket.VerifyManyReceive(0); }
public void MoveToTestCase() { IOSDriver driver = new IOSDriver(defaultUri, capabilities); RequestProcessor re = setupTouchAction(); IWebElement element = driver.FindElementByIosUIAutomation(".elements()"); ITouchAction a; a = new TouchAction(driver) .MoveTo(element, 50, 75); a.Perform(); Assert.AreEqual(re.inputData, "{\"actions\":[{\"action\":\"moveTo\",\"options\":{\"element\":\"5\",\"x\":50,\"y\":75}}]}"); a = new TouchAction(driver) .MoveTo(element, 0.5, 75); a.Perform(); Assert.AreEqual(re.inputData, "{\"actions\":[{\"action\":\"moveTo\",\"options\":{\"element\":\"5\",\"x\":0.5,\"y\":75}}]}"); a = new TouchAction(driver) .MoveTo(0.5, 75); a.Perform(); Assert.AreEqual(re.inputData, "{\"actions\":[{\"action\":\"moveTo\",\"options\":{\"x\":0.5,\"y\":75}}]}"); a = new TouchAction(driver) .MoveTo(element); a.Perform(); Assert.AreEqual(re.inputData, "{\"actions\":[{\"action\":\"moveTo\",\"options\":{\"element\":\"5\"}}]}"); }
public void ProcessRequest(HttpContextBase context) { var settings = new Settings(); var requestProcessor = new RequestProcessor(settings); requestProcessor.Process(context, EvaluatorCallback); }
public async Task <CursoredDisqusResponse <IEnumerable <DisqusInterestingObject <DisqusUser> > > > InterestingUsersAsync(DisqusAccessToken accessToken, int limit) { Collection <KeyValuePair <string, string> > parameters = Parameters .WithParameter("limit", limit) .WithOptionalParameter("access_token", accessToken); var response = await RequestProcessor .ExecuteAsync <CursoredDisqusResponse <DisqusInterestingCollection <DisqusUser> > >(DisqusRequestMethod.Get, DisqusEndpoints.Users.InterestingUsers, parameters) .ConfigureAwait(false); List <DisqusInterestingObject <DisqusUser> > forums = new List <DisqusInterestingObject <DisqusUser> >(); foreach (var interestingForumItem in response.Response.Items) { DisqusUser forum; if (response.Response.Objects.TryGetValue(interestingForumItem.Id, out forum)) { forums.Add(new DisqusInterestingObject <DisqusUser> { Reason = interestingForumItem.Reason, Object = forum }); } } return(new CursoredDisqusResponse <IEnumerable <DisqusInterestingObject <DisqusUser> > > { Cursor = response.Cursor, Code = response.Code, Response = forums }); }
public void Test_Process_BadDeviceToken() { using (TransactionScope scope = new TransactionScope()) { DataSet.TitleRow title = PrepareBasic(); RequestProcessor rp = new RequestProcessor(); try { rp.Process("malformeddevicetokenmalformeddevicetokenmalformeddevicetokenmalf"); Expect(false); } catch (BadDeviceTokenException) { // OK } APNsTableAdapter ata = new APNsTableAdapter(); DataSet.APNsDataTable adt = ata.GetDataByTitleId(title.Id); Expect(adt.Count, Is.EqualTo(0)); SubscriberTableAdapter sta = new SubscriberTableAdapter(); DataSet.SubscriberDataTable sdt = sta.GetDataByTitleId(title.Id); Expect(sdt.Count, Is.EqualTo(0)); } }
public void MultiActionTestCase() { IOSDriver driver = new IOSDriver(defaultUri, capabilities); RequestProcessor re = setupMultiAction(); IWebElement element = driver.FindElementByIosUIAutomation(".elements()"); MultiAction m = new MultiAction(driver); m.Perform(); Assert.AreEqual(re.inputData, ""); TouchAction a1 = new TouchAction(); a1 .Press(element, 100, 100) .Wait(1000) .Release(); m.Add(a1); m.Perform(); Assert.AreEqual(re.inputData, "{\"actions\":[[{\"action\":\"press\",\"options\":{\"element\":\"5\",\"x\":100,\"y\":100}},{\"action\":\"wait\",\"options\":{\"ms\":1000}},{\"action\":\"release\"}]]}"); TouchAction a2 = new TouchAction(); a2 .Tap(100, 100) .MoveTo(element); m.Add(a2); m.Perform(); Assert.AreEqual(re.inputData, "{\"actions\":[[{\"action\":\"press\",\"options\":{\"element\":\"5\",\"x\":100,\"y\":100}},{\"action\":\"wait\",\"options\":{\"ms\":1000}},{\"action\":\"release\"}],[{\"action\":\"tap\",\"options\":{\"x\":100,\"y\":100}},{\"action\":\"moveTo\",\"options\":{\"element\":\"5\"}}]]}"); }
public async Task TestApexRestService() { string requestXML = "<AppointmentBookingRequest><RefreshToken>5Aep861i3pidIObecHklRnSH1FnIZsznQb_i3Jo9UC6ey5emPA8bFpnVVfFu5kexGfE0sWAb1qtfPkJLVQsT4Sd</RefreshToken><IsEmergency>false</IsEmergency><ServiceID>08pe0000000CbHtAAK</ServiceID><IsTest>true</IsTest><IsManaged>false</IsManaged><SchedulingPolicyID>a0Qe000000AzjJNEAZ</SchedulingPolicyID><InstanceName>CS15</InstanceName><OrganizationId>00De0000005T9GFEA0</OrganizationId><OrganizationType>Enterprise Edition</OrganizationType><TravelUnit>km</TravelUnit><SearchSlotsMaxDays>14</SearchSlotsMaxDays><ApprovedAbsences>true</ApprovedAbsences></AppointmentBookingRequest>"; string measurments = RequestProcessor.GetDataByApexRestService(requestXML); Console.WriteLine("Finished successfully"); }
protected override void OnMessage(MessageEventArgs e) { Console.WriteLine("Received: " + e.Data); Send( RequestProcessor.Process(RawRequest.BuildFromString(e.Data)).Transform() ); }
public void If_no_handlers_found_should_fire_onresponse_with_a_404() { _processor = new RequestProcessor(_ruleThatReturnsNoHandlers, new RequestHandlerList()); _processor.Add(_requestHandlerFactory.Get("test")); _processor.OnRequest(new HttpRequestHead(), _dataProducer, _httpResponseDelegate); _httpResponseDelegate.AssertWasCalled(x => x.OnResponse(Arg <HttpResponseHead> .Matches(y => y.Status == "404 NotFound"), Arg <IDataProducer> .Is.Null)); }
public void Error_shown_for_dictionary_load_failure() { var input = "fileNotExists.txt WORD CARD file.txt"; var output = RequestProcessor.ProcessRequest(input); var expectedError = "No values loaded for dictionary: Please check file 'fileNotExists.txt'"; Assert.AreEqual(expectedError, output); }
public void Error_shown_for_invalid_parameters() { var input = "invalid params"; var output = RequestProcessor.ProcessRequest(input); var expectedError = "Invalid parameters: Please check the input and try again:"; Assert.AreEqual(expectedError, output); }
public void Error_shown_for_result_writing_failure() { var input = $"{TestHelper.GetTestFilePath()} WORD WORD notWritableHere.txt"; var output = RequestProcessor.ProcessRequest(input); var expectedError = "Error writing results: Please check file 'notWritableHere.txt'"; Assert.AreEqual(expectedError, output); }
public void If_no_handlers_found_should_fire_onresponse_with_a_404() { _processor = new RequestProcessor(_ruleThatReturnsNoHandlers, new RequestHandlerList()); _processor.Add(_requestHandlerFactory.Get("test")); _processor.OnRequest(new HttpRequestHead(), _dataProducer, _httpResponseDelegate); _httpResponseDelegate.AssertWasCalled(x => x.OnResponse(Arg<HttpResponseHead>.Matches(y => y.Status == "404 NotFound"), Arg<IDataProducer>.Is.Null)); }
public async Task <IDisqusResponse <IEnumerable <DisqusForumCategory> > > ListAsync() { Collection <KeyValuePair <string, string> > parameters = Parameters; return(await RequestProcessor .ExecuteAsync <DisqusResponse <IEnumerable <DisqusForumCategory> > >(DisqusRequestMethod.Get, DisqusEndpoints.ForumCategories.List, parameters) .ConfigureAwait(false)); }
public void Context_EndRequest(object sender, EventArgs e) { // Avoid race conditions. lock (StateStore) { RequestProcessor.ProcessRequestEnd(); } }
private ExecutionPlanner GetExecutor(BatchRequest batchRequest) { var factory = new SampleAPIHttpClientFactory(_Samplefactory, batchRequest.Headers); var processor = new RequestProcessor(factory); var executor = new ExecutionPlanner(processor); return(executor); }
public ResponseMessage Process(IHttpListenerRequestWrapper request) //TODO: breakdown/ be able to use a new route { try { var uriSegments = RequestProcessor.GetProcessedUriSegments(request.Uri); dynamic controller = RequestProcessor.GetController(uriSegments[1], _dataManager); var id = RequestProcessor.GetId(uriSegments); var verb = RequestProcessor.GetVerb(request.HttpMethod); _logger.Debug($"controller/model: {uriSegments[1]}, id: {id}, verb: {verb}"); switch (verb) { case HttpVerb.Get: //Routing // URL var getMessage = id == null ? controller.Get() : controller.Get(id.GetValueOrDefault()); _logger.Information("Preparing get message"); return(new ResponseMessage(HttpStatusCode.OK, getMessage)); case HttpVerb.Put: //URL and body var modelToUpdate = RequestProcessor.GetModel(uriSegments[1], request); if (id == null) { throw new HttpRequestException("Page not found for put request: ", HttpStatusCode.NotFound); } var updatedUser = controller.Put(modelToUpdate, id.GetValueOrDefault()); _logger.Information("Preparing put message"); return(new ResponseMessage(HttpStatusCode.OK, updatedUser)); case HttpVerb.Post: //body var modelToCreate = RequestProcessor.GetModel(uriSegments[1], request); var newUser = controller.Post(modelToCreate); _logger.Information("Preparing post message"); return(new ResponseMessage(HttpStatusCode.Created, newUser)); case HttpVerb.Delete: //URL controller.Delete(id.GetValueOrDefault()); _logger.Information("Preparing delete message"); return(new ResponseMessage(HttpStatusCode.OK, $"Deleted {uriSegments[1]} id:{id}")); default: throw new HttpRequestException($"Invalid http method: {verb} for ", HttpStatusCode.MethodNotAllowed); } } catch (RequestException e) { var httpResponseMessage = e.AsHttpResponse(request.Uri); return(httpResponseMessage); } catch (Exception e) { var statusCode = HttpStatusCode.InternalServerError; _logger.Error($"Exception message: {e.Message}, Status Code: {(int) statusCode } {statusCode}"); return(new ResponseMessage(statusCode, e.Message)); } }
public void Error_shown_when_no_path_exists() { var resultsPath = GetValidOutputPath(); var input = $"{TestHelper.GetTestFilePath()} wash path {resultsPath}"; var output = RequestProcessor.ProcessRequest(input); var expectedError = "No path found between WASH and PATH"; Assert.AreEqual(expectedError, output); }
/// <summary> /// Initializes a new instance of the <see cref="AdobeConnectProvider"/> class. /// </summary> /// <param name="connectionDetails"> /// The connection details. /// </param> /// <exception cref="ArgumentNullException"> /// ConnectionDetails should not be null /// </exception> public AdobeConnectProvider(ConnectionDetails connectionDetails) { if (connectionDetails == null) { throw new ArgumentNullException(nameof(connectionDetails)); } requestProcessor = new RequestProcessor(connectionDetails); }
public SupervisorDashboardChannel(string guid) { Conversation = (Conversation)LyncClient.GetHostingConversation(); ApplicationId = guid; _requestProcessor = new RequestProcessor(null); _agents = new Dictionary <string, agentType>(); Conversation.ContextDataReceived += ConversationContextDataReceived; }
public async Task DeleteUser(string username) { var resultSet = await RequestProcessor.SendQuery( Queries.GetDropUserQuery(username), CancellationToken.None ).ConfigureAwait(false); resultSet.EnsureEmptySuccessResult(); }
public async static Task <(byte[] Header, byte[] Body)> GenerateResponse(this RequestProcessor processor, HttpRequest request) { var resp = await processor.Invoke(request); var body = resp.Body; var header = GenerateHeader(resp.Status, body.Length, resp.Header, resp.ContentType); return(header, body); }
public Program( CommandProcessor commandProcessor, RequestProcessor requestProcessor, DirectoryInfo rootDirectory) { this.commandProcessor = commandProcessor; this.requestProcessor = requestProcessor; this.rootDirectory = rootDirectory; }
public async Task DropDatabase(string databaseName) { var resultSet = await RequestProcessor.SendQuery( Queries.GetDropDatabaseQuery(databaseName), CancellationToken.None ).ConfigureAwait(false); resultSet.EnsureEmptySuccessResult(); }
public async Task RevokeClusterAdminPrivilege(string username) { var resultSet = await RequestProcessor.SendQuery( Queries.GetRevokeClusterAdminPrivilegeQuery(username), CancellationToken.None ).ConfigureAwait(false); resultSet.EnsureEmptySuccessResult(); }
public async Task RevokePrivilege(string databaseName, string username, Privilege privilege) { var resultSet = await RequestProcessor.SendQuery( Queries.GetRevokePrivilegeQuery(databaseName, username, privilege), CancellationToken.None ).ConfigureAwait(false); resultSet.EnsureEmptySuccessResult(); }
public async Task AlterRetentionPolicy(string retentionPolicyName, string databaseName, Retention duration = null, int?replication = null, bool?isDefault = false) { var resultSet = await RequestProcessor.SendQuery( Queries.GetAlterRetentionPoliciesQuery(retentionPolicyName, databaseName, duration, replication, isDefault), CancellationToken.None ).ConfigureAwait(false); resultSet.EnsureEmptySuccessResult(); }
public async Task SetUserPassword(string username, string password) { var resultSet = await RequestProcessor.SendQuery( Queries.GetSetUserPasswordQuery(username, password), CancellationToken.None ).ConfigureAwait(false); resultSet.EnsureEmptySuccessResult(); }
public async Task <User[]> GetUsers(CancellationToken cancellationToken = default(CancellationToken)) { var resultSet = await RequestProcessor.SendQuery( Queries.GetShowUsersQuery(), CancellationToken.None ).ConfigureAwait(false); return(resultSet.ToUsers()); }
public async Task <RetentionPolicy[]> GetRetentionPolicies(string databaseName) { var resultSet = await RequestProcessor.SendQuery( Queries.GetShowRetentionPoliciesQuery(databaseName), CancellationToken.None ).ConfigureAwait(false); return(resultSet.ToRetentionPolicies()); }
public async Task CreateUser(string username, string password, bool isClusterAdmin) { var resultSet = await RequestProcessor.SendQuery( Queries.GetCreateUserQuery(username, password, isClusterAdmin), CancellationToken.None ).ConfigureAwait(false); resultSet.EnsureEmptySuccessResult(); }
public void Matching_HEAD_handler_should_output_handlers_expected_response_with_null_body() { _processor = new RequestProcessor(_ruleThatReturnsFirstHandler, new RequestHandlerList()); RequestHandler requestHandler = _requestHandlerFactory.Head("test"); _processor.Add(requestHandler); var httpRequestHead = new HttpRequestHead { Method = "HEAD", Headers = new Dictionary<string, string>() }; _processor.OnRequest(httpRequestHead, _dataProducer, _httpResponseDelegate); _httpResponseDelegate.AssertWasCalled(x => x.OnResponse(requestHandler.ResponseBuilder.BuildHeaders(), null)); }
public void If_a_handler_found_should_fire_onresponse_with_that_repsonse() { _processor = new RequestProcessor(_ruleThatReturnsFirstHandler, new RequestHandlerList()); RequestHandler requestHandler = _requestHandlerFactory.Get("test"); _processor.Add(requestHandler); Dictionary<string, string> headers = new Dictionary<string, string>(); _processor.OnRequest(new HttpRequestHead{ Headers = headers}, _dataProducer, _httpResponseDelegate); _httpResponseDelegate.AssertWasCalled( x => x.OnResponse(requestHandler.ResponseBuilder.BuildHeaders(), requestHandler.ResponseBuilder.BuildBody(headers))); }
static WorkerThreadPoolSynchronizer() { _threadPool = new RequestProcessor("Notification Processor"); var max = 6000; var min = 1000; System.Console.WriteLine("Max LongPooling threads: '{0}'", max); System.Console.WriteLine("Min LongPooling threads: '{0}'", min); _threadPool.Start(max, min); //_threadPool.Start(7000, 3000); //_threadPool.Start(500, 300); }
public void Test_Process_ExistSubscriber() { using (TransactionScope scope = new TransactionScope()) { DataSet.TitleRow title = PrepareBasic(); DataSet.SubscriberRow subscriber = PrepareExist(title); RequestProcessor rp = new RequestProcessor(); rp.Process("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"); APNsTableAdapter ata = new APNsTableAdapter(); DataSet.APNsDataTable adt = ata.GetDataByTitleId(title.Id); Expect(adt.Count, Is.EqualTo(1)); Expect(adt[0].DeviceToken, Is.EqualTo("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef")); TokenTableAdapter tta = new TokenTableAdapter(); DataSet.TokenDataTable tdt = tta.GetDataBySubscriberId(subscriber.Id); Expect(tdt.Count, Is.EqualTo(2)); } }
// Use :name to capture param values. // Name must fit in the following regex: [a-zA-Z0-9_$-\.]+ public void Use(string path, RequestProcessor proc) { Use(GetPathRegex(path), proc); }
public void Test_Process_NewSubscriber() { using (TransactionScope scope = new TransactionScope()) { DataSet.TitleRow title = PrepareBasic(); RequestProcessor rp = new RequestProcessor(); rp.Process("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"); APNsTableAdapter ata = new APNsTableAdapter(); DataSet.APNsDataTable adt = ata.GetDataByTitleId(title.Id); Expect(adt.Count, Is.EqualTo(1)); Expect(adt[0].DeviceToken, Is.EqualTo("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef")); SubscriberTableAdapter sta = new SubscriberTableAdapter(); DataSet.SubscriberDataTable sdt = sta.GetDataByTitleId(title.Id); Expect(sdt.Count, Is.EqualTo(1)); DataSet.SubscriberRow subscriber = sdt[0]; Expect(subscriber.AuthScheme, Is.EqualTo(AuthScheme.iOS_APNs.ToString())); TokenTableAdapter tta = new TokenTableAdapter(); DataSet.TokenDataTable tdt = tta.GetDataBySubscriberId(subscriber.Id); Expect(tdt.Count, Is.EqualTo(1)); } }
public void When_a_handler_is_hit_handlers_request_count_is_incremented() { string expectedPath = "/blah/test"; string expectedMethod = "GET"; var requestProcessor = new RequestProcessor(_ruleThatReturnsFirstHandler, new RequestHandlerList()); requestProcessor.Add(_requestHandlerFactory.Get(expectedPath)); var httpRequestHead = new HttpRequestHead { Headers = new Dictionary<string, string>() }; httpRequestHead.Path = expectedPath; httpRequestHead.Method = expectedPath; requestProcessor.OnRequest(httpRequestHead, _dataProducer, _httpResponseDelegate); var handler = requestProcessor.FindHandler(expectedMethod, expectedPath); Assert.That(handler.RequestCount(), Is.EqualTo(1)); }
public void When_a_handler_is_added_should_be_able_to_find_it() { string expectedPath = "/blah/test"; string expectedMethod = "GET"; var requestProcessor = new RequestProcessor(null, new RequestHandlerList()); requestProcessor.Add(_requestHandlerFactory.Get(expectedPath)); var handler = (RequestHandler) requestProcessor.FindHandler(expectedMethod, expectedPath); Assert.That(handler.Path, Is.EqualTo(expectedPath)); Assert.That(handler.Method, Is.EqualTo(expectedMethod)); }
public void SetUp() { _processor = new RequestProcessor(_ruleThatReturnsFirstHandler, new RequestHandlerList()); _requestHandlerFactory = new RequestHandlerFactory(_processor); _dataProducer = MockRepository.GenerateStub<IDataProducer>(); _httpResponseDelegate = MockRepository.GenerateStub<IHttpResponseDelegate>(); _ruleThatReturnsFirstHandler = MockRepository.GenerateStub<IMatchingRule>(); _ruleThatReturnsFirstHandler.Stub(x => x.IsEndpointMatch(null, new HttpRequestHead())).IgnoreArguments().Return(true).Repeat.Once(); _ruleThatReturnsNoHandlers = MockRepository.GenerateStub<IMatchingRule>(); _ruleThatReturnsNoHandlers.Stub(x => x.IsEndpointMatch(null, new HttpRequestHead())).IgnoreArguments().Return(false); }
public void Returns_mock_not_found_when_handler_constraints_cannot_be_verified() { var excludePhrase = "OhMyDaysssss"; var handlerWithConstraints = new RequestHandler("", null); handlerWithConstraints.WithUrlConstraint(uri => uri.Contains(excludePhrase) == false); var matchingRule = MockRepository.GenerateMock<IMatchingRule>(); matchingRule.Stub(m => m.IsEndpointMatch(Arg<IRequestHandler>.Is.Anything, Arg<HttpRequestHead>.Is.Anything)).Return(true); var p = new RequestProcessor(matchingRule, new RequestHandlerList { handlerWithConstraints }); var response = MockRepository.GenerateMock<IHttpResponseDelegate>(); p.OnRequest(new HttpRequestHead{Uri = "http://blah.com/cheese/" + excludePhrase}, null, response); var notFoundResponse = (HttpResponseHead)response.GetArgumentsForCallsMadeOn( r => r.OnResponse(Arg<HttpResponseHead>.Is.Anything, Arg<IDataProducer>.Is.Anything))[0][0]; Assert.That(notFoundResponse.Status == "404 NotFound"); }
static BinaryHttpHandler() { _requestProcessor = new RequestProcessor(new Repository("Correspondence") .UpgradeDatabase(), new Correspondence.Distributor.WindowsPhone.Broker()); }
private void Listen () { while (!_stopped) { Socket socket = null; try { socket = listener.Accept (); } catch (SocketException ex) { // ignore interruption of blocking call if (ex.ErrorCode != SOCKET_CLOSED) throw; break; } RequestProcessor processor = new RequestProcessor (socket, _requestHandler); Thread t = new Thread (new ThreadStart (processor.Process)); t.Start (); } }
public void ServerLoop() { Log.Information ("Listening on " + listener.LocalEndpoint); while (true) { TcpClient client = listener.AcceptTcpClient (); if (client.Connected) { if (stats != null) stats.IncomingRequest ((client.Client.RemoteEndPoint as IPEndPoint).Address); RequestProcessor parser = new RequestProcessor (client, handlers); new Thread (new ThreadStart (parser.Process)).Start (); } } }
public void Test_Process_ExistSubscriber_ApnsFailed() { using (TransactionScope scope = new TransactionScope()) { DataSet.TitleRow title = PrepareBasic(); DataSet.SubscriberRow subscriber = PrepareExist(title); APNsTableAdapter ata = new APNsTableAdapter(); DataSet.APNsDataTable adt = ata.GetDataByTitleId(title.Id); adt[0].Failed = true; ata.Update(adt); RequestProcessor rp = new RequestProcessor(); rp.Process("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"); adt = ata.GetDataByTitleId(title.Id); Expect(adt[0].Failed, Is.EqualTo(false)); } }
public DebugProcessingWorkflow(RequestProcessor processor) { this.processor = processor; }
public void Use(Regex regex, RequestProcessor proc) { routes.Add(new Tuple<Regex, RequestProcessor>(regex, proc)); }
public void Use(RequestProcessor proc) { Use((Regex)null, proc); }
public HLMaterServer(RequestProcessor rp) { RequestProcessor = rp; }