private static void DoNotify(NotifyEventProxy<EpoxyConnection> proxy, int requestNum, string payload, UInt16 delay) { var request = new PingRequest { Payload = payload, DelayMilliseconds = delay }; proxy.NotifyAsync(request); Console.WriteLine($"P Event #{requestNum} Delay: {delay}"); }
public PingResponse Any(PingRequest request) { if (request.MSTimeBeforeResponse != 0) { Thread.Sleep(request.MSTimeBeforeResponse); } #if DEBUG if (request.ThrowException) { throw new Exception("Forced exception."); } #endif var versionResponse = new PingResponse { FullVersion = GetApplicationVersion() }; return (versionResponse); }
/// <summary> /// Ping服务 /// </summary> /// <param name="request">Ping请求消息</param> /// <returns> /// Ping响应消息 /// </returns> public PingResponse Ping(PingRequest request) { PingResponse response = new PingResponse() { Status = HeartBeatStatus.Unknown }; try { response = OnPing(); } catch (Exception ex) { response.Status = HeartBeatStatus.Sick; response.StatusMessage = ex.Message; ExceptionHandler.Handle(ex); } return response; }
public void MSASCMD_S11_TC08_Ping_WithoutRequestBody() { #region Call Ping command with request body PingRequest pingRequest = CreatePingRequest(this.User1Information.InboxCollectionId, Request.PingFolderClass.Email); pingRequest.RequestData.HeartbeatInterval = "60"; PingResponse pingResponse = this.CMDAdapter.Ping(pingRequest); // According to techinical specification, if there were changes occurred in the Inbox folder, the Ping response would return 2. // Reissue the Ping command when the Sync command completes to stay up to date. int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site)); int waitTime = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site)); int counter = 1; while (counter < retryCount && 2 == int.Parse(pingResponse.ResponseData.Status)) { System.Threading.Thread.Sleep(waitTime); SyncRequest syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User1Information.InboxCollectionId); this.Sync(syncRequest); syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey; this.Sync(syncRequest); pingResponse = this.CMDAdapter.Ping(pingRequest); counter++; } Site.Assert.AreEqual<int>(1, int.Parse(pingResponse.ResponseData.Status), "The Ping command should be successful."); #endregion #region Create a ping request without request body pingRequest = new PingRequest(); pingRequest.RequestData = null; #endregion #region Call Ping command pingResponse = this.CMDAdapter.Ping(pingRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R335"); // Verify MS-ASCMD requirement: MS-ASCMD_R335 Site.CaptureRequirementIfAreEqual<int>( 1, int.Parse(pingResponse.ResponseData.Status), 335, @"[In Ping] A Ping command can be sent with no body, in which case the cached version is used."); #endregion }
public void MSASCMD_S11_TC02_Ping_Status4() { #region Create one initial ping request without HeartbeatInterval element that means to create one poorly formatted WBXML. PingRequest pingRequest = new PingRequest { RequestData = new Request.Ping() }; PingResponse pingResponse = this.CMDAdapter.Ping(pingRequest); #endregion #region Verify Requirements MS-ASCMD_R4244, MS-ASCMD_R4228 // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4244"); // Verify MS-ASCMD requirement: MS-ASCMD_R4244 Site.CaptureRequirementIfAreEqual<int>( 4, int.Parse(pingResponse.ResponseData.Status), 4244, @"[In Status(Ping)] [When the scope is Global], [the cause of the status value 4 is] Frequently caused by poorly formatted WBXML."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4228"); // Verify MS-ASCMD requirement: MS-ASCMD_R4228 Site.CaptureRequirementIfAreEqual<int>( 4, int.Parse(pingResponse.ResponseData.Status), 4228, @"[In Status(Ping)] If the command failed, the Status element contains a code that indicates the type of failure."); #endregion }
static PingRequest() { Instance = new PingRequest(); }
public BinaryMessage Ping (PingRequest msg) { return msg.CreateResponse (); }
public PingResponse Execute(PingRequest request) { return new PingResponse {Value = "OK"}; }
public virtual PongResponse Ping(PingRequest request) { return PingImplementation(request); }
/// <summary> /// Create a PingRequest instance using specified PingFolder array and heartbeatInterval /// </summary> /// <param name="folders">Specified PingFolder array</param> /// <param name="heartbeatInterval">Specified heartbeatInterval</param> /// <returns>A PingRequest instance</returns> public static PingRequest CreatePingRequest(Request.PingFolder[] folders, string heartbeatInterval) { PingRequest request = new PingRequest(); Request.Ping requestData = new Request.Ping { Folders = folders, HeartbeatInterval = heartbeatInterval }; request.RequestData = requestData; return request; }
/// <summary> /// Create an empty PingRequest instance /// </summary> /// <returns>A PingRequest instance</returns> public static PingRequest CreatePingRequest() { PingRequest request = new PingRequest(); Request.Ping requestData = new Request.Ping(); request.RequestData = requestData; return request; }
public abstract PingResponse GetPing(PingRequest pingRequest);
private async Task PingWithLocation() { PingRequest ping = new PingRequest(); ping.Latitude = _location.Latitude; ping.Longitude = _location.Longitude; await ping.Ping(); }
public override PingResponse GetPing(PingRequest pingRequest) { throw new NotImplementedException(); }
private static async Task DoPingPong(PingPongProxy<EpoxyConnection> proxy, int requestNum, string payload, UInt16 delay) { var request = new PingRequest { Payload = payload, DelayMilliseconds = delay }; IMessage<PingResponse> message = await proxy.PingAsync(request); if (message.IsError) { Error error = message.Error.Deserialize(); Console.WriteLine($"Request #{requestNum} failed: {error.error_code}: {error.message}"); } else { PingResponse response = message.Payload.Deserialize(); Console.WriteLine($"Request #{requestNum} response: \"{response.Payload}\". Delay: {delay}"); } }
public void Ping(PingRequest pingRequest) { SendRequest(pingRequest.ToXML()); }