public static IAsyncResult BeginOperation(AsyncCall call, AsyncCallback callback, object state) { AsyncResult result = new AsyncResult(callback, state); new Thread(() => Execute(call, result)).Start(); return(result); }
private static IEnumerator<IAsyncCall> Echo(Socket client) { byte[] buffer = new byte[1024]; AsyncCall<int> call = new AsyncCall<int>(); while (true) { yield return call .WaitOn(cb => client.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, cb, null)) & client.EndReceive; int bytes = call.Result; if (bytes > 0) { Console.WriteLine("read {0} bytes from {1}", bytes, client.RemoteEndPoint); yield return call .WaitOn(cb => client.BeginSend(buffer, 0, bytes, SocketFlags.None, cb, null)) & client.EndReceive; Console.WriteLine("sent {0} bytes to {1}", bytes, client.RemoteEndPoint); } else { break; } } Console.WriteLine("closing client socket {0}", client.RemoteEndPoint); client.Close(); }
public static AsyncServerStreamingCall <TResponse> AsyncServerStreamingCall <TRequest, TResponse>(CallInvocationDetails <TRequest, TResponse> call, TRequest req, Action customDisposeAction, string id) where TRequest : class where TResponse : class { var asyncCall = new AsyncCall <TRequest, TResponse>(call); asyncCall.StartServerStreamingCall(req); var responseStream = new ClientResponseStream <TRequest, TResponse>(asyncCall); var token = asyncCall.Details.Options.CancellationToken; if (token.CanBeCanceled) { token.Register(() => { customDisposeAction(); }); return(new AsyncServerStreamingCall <TResponse>(responseStream, asyncCall.ResponseHeadersAsync, asyncCall.GetStatus, asyncCall.GetTrailers, asyncCall.Cancel)); } else { return(new AsyncServerStreamingCall <TResponse>(responseStream, asyncCall.ResponseHeadersAsync, asyncCall.GetStatus, asyncCall.GetTrailers, () => { asyncCall.Cancel(); customDisposeAction(); })); } }
public void Test_CoordinationDataStructures_AsyncCoordination_AsyncCall_1() { // //模式:为每个提交数据项异步调用一个处理程序 // 生产、消费分两种模式,1、同步式:是消费者同步消费生产者的数据,等待生产者的数据,BlockingCollection<T>是属于这种模式 ; // 2、异步式:生产者把数据加入到共享队列中,并通知监听此队列的消费者,从而消费者取出数据进行处理,“取出”数据 // 有两种模式,a,顺序取出;b,并行取出 // var call = new AsyncCall <int>( e => { // 返回 task 为异步执行任务 ,直接使用action 为同步执行 var tt = new Task(() => Console.WriteLine(e)); tt.Start(); return(tt); } , maxDegreeOfParallelism: Environment.ProcessorCount); call.Post(1); call.Post(2); call.Post(3); call.Post(4); Assert.IsTrue(true); }
void Update() { // Call the method at the next fixed frame update. AsyncCall.CallOnFixedUpdate(this, () => Debug.Log("Async call!")); // Wait for one fixed frame update and then call. AsyncCall.CallOnFixedUpdate(this, () => Debug.Log("Next frame async call!"), skipFrames: 1); }
private static IEnumerator <IAsyncCall> Echo(Socket client) { byte[] buffer = new byte[1024]; AsyncCall <int> call = new AsyncCall <int>(); while (true) { yield return(call .WaitOn(cb => client.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, cb, null)) & client.EndReceive); int bytes = call.Result; if (bytes > 0) { Console.WriteLine("read {0} bytes from {1}", bytes, client.RemoteEndPoint); yield return(call .WaitOn(cb => client.BeginSend(buffer, 0, bytes, SocketFlags.None, cb, null)) & client.EndReceive); Console.WriteLine("sent {0} bytes to {1}", bytes, client.RemoteEndPoint); } else { break; } } Console.WriteLine("closing client socket {0}", client.RemoteEndPoint); client.Close(); }
internal Task(TaskManager taskManager, IEnumerator<IAsyncCall> callIterator) { this._waitCall = new AsyncCall<bool>(); this._taskManager = taskManager; this._taskState = TaskState.Unstarted; this._asyncCallIterator = callIterator; }
/// <inheritdoc/> public virtual void DecoupleAction(string nodeName, bool weDecouple) { if (nodeName == attachNodeName) { AsyncCall.CallOnEndOfFrame(this, CheckCoupleNode); } }
private static void RegisterCancellationCallback <TRequest, TResponse>(AsyncCall <TRequest, TResponse> asyncCall, CancellationToken token) { if (token.CanBeCanceled) { token.Register(() => asyncCall.Cancel()); } }
/// <summary>Handles keyboard input.</summary> private void UpdateKey() { if (isRunning) { if (KIS_Shared.IsKeyUp(KeyCode.Escape) || KIS_Shared.IsKeyDown(KeyCode.Return)) { Debug.Log("Cancel key pressed, stop eva attach mode"); StopPointer(unlockUI: false); SendPointerClick(PointerTarget.Nothing, Vector3.zero, Quaternion.identity, null, null); // Delay unlocking to not let ESC be handled by the game. AsyncCall.CallOnEndOfFrame(this, UnlockUI); } if (GameSettings.Editor_toggleSymMethod.GetKeyDown()) // "R" by default. { if (pointerTarget != PointerTarget.PartMount && attachNodes.Count() > 1) { attachNodeIndex++; if (attachNodeIndex > (attachNodes.Count - 1)) { attachNodeIndex = 0; } Debug.LogFormat("Attach node index changed to: {0}", attachNodeIndex); UpdatePointerAttachNode(); ResetMouseOver(); SendPointerState(pointerTarget, PointerState.OnChangeAttachNode, null, null); } else { ScreenMessaging.ShowInfoScreenMessage("This part has only one attach node!"); audioBipWrong.Play(); } } } }
private void CallApp_Idle() { m_ActivityMonitor.Enabled = false; m_AutoLockForm = new AutoLockForm(); DialogResult result = m_AutoLockForm.ShowDialog(); if (result == DialogResult.Cancel) { AsyncCall dlLogin = CallLogin; dlLogin.BeginInvoke(null, null); } if (result == DialogResult.OK) { m_ActivityMonitor.Enabled = true; } m_AutoLockForm.Dispose(); m_AutoLockForm = null; if (m_LastRemoteEventId != null && (DateTime.Now - m_LastRemoteEventRequestDate).TotalSeconds < 100) { ShowEventDetail(m_LastRemoteEventId); } m_LastRemoteEventId = null; }
/// <summary> /// Goes thru the parts on the source and target vessels, and tries to restore the coupling /// between the parts. /// </summary> /// <remarks> /// Any linking module on the source or the target vessel, which is linked and in the docking /// mode, will be attempted to use to restore the vessels coupling. This work will be done at the /// end of frame to let the other logic to cleanup. /// </remarks> /// <param name="tgtPart"> /// The former target part that was holding the coupling with this part. /// </param> void DelegateCouplingRole(Part tgtPart) { AsyncCall.CallOnEndOfFrame(this, () => { var candidates = new List <ILinkJoint>() .Concat(vessel.parts .SelectMany(p => p.Modules.OfType <ILinkJoint>()) .Where(j => !ReferenceEquals(j, this) && j.coupleOnLinkMode && j.isLinked && j.linkTarget.part.vessel == tgtPart.vessel)) .Concat(tgtPart.vessel.parts .SelectMany(p => p.Modules.OfType <ILinkJoint>()) .Where(j => j.coupleOnLinkMode && j.isLinked && j.linkTarget.part.vessel == vessel)); foreach (var joint in candidates) { HostedDebugLog.Fine(this, "Trying to couple via: {0}", joint); if (joint.SetCoupleOnLinkMode(true)) { HostedDebugLog.Info(this, "The coupling role is delegated to: {0}", joint); return; } } if (candidates.Any()) { HostedDebugLog.Warning(this, "None of the found candidates took the coupling role"); } }); }
public void AsyncCall_To_Func() { var processedCount = 0; Func <int, Task> @function = x => Task.Factory.StartNew(() => { Interlocked.Increment(ref processedCount); if (IsDebugEnabled) { log.Debug("Called with Item[{0}]. ProcessedCount={1}", x, processedCount); } }, TaskCreationOptions.PreferFairness); // var asyncCall = AsyncCall.Create(@function); var asyncCall = AsyncCall.Create(@function, Environment.ProcessorCount, null); Enumerable.Range(0, IterationCount).RunEach(asyncCall.Post); // 비동기 호출이므로, 걍 끝내면 모두 실행되지 않거든요... Thread.Sleep(IterationCount * 10); Assert.AreEqual(IterationCount, processedCount); }
public static IAsyncResult BeginOperation(AsyncCall call, AsyncCallback callback, object state) { DynamoDBAsyncResult result = new DynamoDBAsyncResult(callback, state); ThreadPool.QueueUserWorkItem(s => Execute(call, result)); return(result); }
/// <summary>Overridden from MonoBehaviour.</summary> /// <remarks>Tracks keys and mouse moveement.</remarks> void Update() { switchStabilizationModeKey.Update(); if (vesselSwitchKey.Update()) { HandleVesselSelection(); } if (partFocusSwitchKey.Update()) { HandleCameraFocusSelection(); } // Core KSP logic highlights hovered parts. Once focus is lost so does the highlight state on // the part. Here we detect changing focus in scope of the current vessel, and restore EVS // highlighting when mouse focus moves out. if (_hoveredVessel == null) { _lastHoveredPart = null; } else if (_lastHoveredPart != Mouse.HoveredPart) { if (_lastHoveredPart != null && _lastHoveredPart.vessel == _hoveredVessel) { // Let game core to disable highlighter and then restore it. var restoreHighlightPart = _lastHoveredPart; // Make a cope for the delayed call. if (isHighlightingEnabled) { AsyncCall.CallOnEndOfFrame( this, () => restoreHighlightPart.highlighter.ConstantOn(targetVesselHighlightColor)); } } _lastHoveredPart = Mouse.HoveredPart; } }
/// <inheritdoc/> public virtual void OnPartUnpack() { // The check may want to establish a link, but this will only succeed if the physics has // started. HostedDebugLog.Fine(this, "Schedule coupling check from UNPACK..."); AsyncCall.CallOnEndOfFrame(this, CheckCoupleNode); }
public static void AsyncServerStreamingCall <TRequest, TResponse>(Call <TRequest, TResponse> call, TRequest req, IObserver <TResponse> outputs, CancellationToken token) { var asyncCall = new AsyncCall <TRequest, TResponse>(call.RequestSerializer, call.ResponseDeserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.MethodName); asyncCall.StartServerStreamingCall(req, outputs); }
public static async Task <TResponse> AsyncUnaryCall <TRequest, TResponse>(Call <TRequest, TResponse> call, TRequest req, CancellationToken token) { var asyncCall = new AsyncCall <TRequest, TResponse>(call.RequestSerializer, call.ResponseDeserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.MethodName); return(await asyncCall.UnaryCallAsync(req)); }
/// <inheritdoc/> public override void OnUpdate() { base.OnUpdate(); if (linkState == LinkState.Linking && guiLinkMode == GUILinkMode.Interactive) { UpdateLinkingState(); // Handle link mode cancel. if (Input.GetKeyUp(KeyCode.Escape)) { AsyncCall.CallOnEndOfFrame(this, CancelLinking); } // Handle link action (mouse click). if (Input.GetKeyDown(KeyCode.Mouse0)) { if (targetCandidateIsGood) { AsyncCall.CallOnEndOfFrame(this, () => LinkToTarget(targetCandidate)); } else { UISoundPlayer.instance.Play(KASAPI.CommonConfig.sndPathBipWrong); } } } }
public static void AsyncOperation <T>(AsyncCall call, string operation, AmazonDynamoCallback <T> callback, object state) { DynamoDBAsyncState <T> result = new DynamoDBAsyncState <T>(operation, callback, state); ThreadPool.QueueUserWorkItem(s => Execute(call, result)); return; }
public override AsyncUnaryCall <TResponse> AsyncUnaryCall <TRequest, TResponse>(Method <TRequest, TResponse> method, string host, CallOptions options, TRequest request) { var call = CreateCall(method, host, options); var asyncCall = new AsyncCall <TRequest, TResponse>(call); var asyncResult = HandleUnaryCall(asyncCall.UnaryCallAsync(request), call); return(new AsyncUnaryCall <TResponse>(asyncResult, asyncCall.ResponseHeadersAsync, asyncCall.GetStatus, asyncCall.GetTrailers, asyncCall.Cancel)); }
/// <summary> /// Сейчас функция реализована как синхронная. /// /// Если операция будет выполняться асинхронно, то исключения возникшие в асинхронном потоке /// перебрасываются в потоке который вызвал DoAsync. /// </summary> /// <param name="action">Длинное действие, которое должно выполняться асинхронно</param> /// <returns>резултат выполнения action</returns> public static object DoAsync(AsyncCall action) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; var result = action(); Mouse.OverrideCursor = null; return(result); }
/// <summary> /// Invokes a simple remote call in a blocking fashion. /// </summary> /// <returns>The response.</returns> /// <param name="call">The call defintion.</param> /// <param name="req">Request message.</param> /// <typeparam name="TRequest">Type of request message.</typeparam> /// <typeparam name="TResponse">The of response message.</typeparam> public static TResponse BlockingUnaryCall <TRequest, TResponse>(CallInvocationDetails <TRequest, TResponse> call, TRequest req) where TRequest : class where TResponse : class { var asyncCall = new AsyncCall <TRequest, TResponse>(call); return(asyncCall.UnaryCall(req)); }
/// <inheritdoc/> public virtual void DecoupleAction(string nodeName, bool weDecouple) { if (nodeName == attachNodeName) { HostedDebugLog.Fine(this, "Schedule coupling check from DECOUPLE action..."); AsyncCall.CallOnEndOfFrame(this, CheckCoupleNode); } }
void Awake() { ConfigAccessor.ReadFieldsInType(GetType(), this); if (twekerEnabled) { AsyncCall.CallOnEndOfFrame(this, WaitAndApplyTweaks); } }
public static IObserver <TRequest> DuplexStreamingCall <TRequest, TResponse>(Call <TRequest, TResponse> call, IObserver <TResponse> outputs, CancellationToken token) { var asyncCall = new AsyncCall <TRequest, TResponse>(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); asyncCall.StartDuplexStreamingCall(outputs, call.Headers); return(new ClientStreamingInputObserver <TRequest, TResponse>(asyncCall)); }
static void AssertStreamingResponseSuccess(AsyncCall <string, string> asyncCall, FakeNativeCall fakeCall, Task <bool> moveNextTask) { Assert.IsTrue(moveNextTask.IsCompleted); Assert.IsTrue(fakeCall.IsDisposed); Assert.IsFalse(moveNextTask.Result); Assert.AreEqual(Status.DefaultSuccess, asyncCall.GetStatus()); Assert.AreEqual(0, asyncCall.GetTrailers().Count); }
public void Init() { channel = new Channel("localhost", Credentials.Insecure); fakeCall = new FakeNativeCall(); var callDetails = new CallInvocationDetails<string, string>(channel, "someMethod", null, Marshallers.StringMarshaller, Marshallers.StringMarshaller, new CallOptions()); asyncCall = new AsyncCall<string, string>(callDetails, fakeCall); }
/// <summary> /// Invokes a simple remote call asynchronously. /// </summary> /// <returns>An awaitable call object providing access to the response.</returns> /// <param name="call">The call defintion.</param> /// <param name="req">Request message.</param> /// <typeparam name="TRequest">Type of request message.</typeparam> /// <typeparam name="TResponse">The of response message.</typeparam> public static AsyncUnaryCall <TResponse> AsyncUnaryCall <TRequest, TResponse>(CallInvocationDetails <TRequest, TResponse> call, TRequest req) where TRequest : class where TResponse : class { var asyncCall = new AsyncCall <TRequest, TResponse>(call); var asyncResult = asyncCall.UnaryCallAsync(req); return(new AsyncUnaryCall <TResponse>(asyncResult, asyncCall.GetStatus, asyncCall.GetTrailers, asyncCall.Cancel)); }
/// <summary> /// Invokes a client streaming call asynchronously. /// In client streaming scenario, client sends a stream of requests and server responds with a single response. /// </summary> /// <returns>An awaitable call object providing access to the response.</returns> /// <typeparam name="TRequest">Type of request messages.</typeparam> /// <typeparam name="TResponse">The of response message.</typeparam> public static AsyncClientStreamingCall <TRequest, TResponse> AsyncClientStreamingCall <TRequest, TResponse>(CallInvocationDetails <TRequest, TResponse> call) where TRequest : class where TResponse : class { var asyncCall = new AsyncCall <TRequest, TResponse>(call); var resultTask = asyncCall.ClientStreamingCallAsync(); var requestStream = new ClientRequestStream <TRequest, TResponse>(asyncCall); return(new AsyncClientStreamingCall <TRequest, TResponse>(requestStream, resultTask, asyncCall.GetStatus, asyncCall.GetTrailers, asyncCall.Cancel)); }
static void AssertUnaryResponseSuccess(AsyncCall <string, string> asyncCall, FakeNativeCall fakeCall, Task <string> resultTask) { Assert.IsTrue(resultTask.IsCompleted); Assert.IsTrue(fakeCall.IsDisposed); Assert.AreEqual(Status.DefaultSuccess, asyncCall.GetStatus()); Assert.AreEqual(0, asyncCall.ResponseHeadersAsync.Result.Count); Assert.AreEqual(0, asyncCall.GetTrailers().Count); Assert.AreEqual("response1", resultTask.Result); }
public static TResponse BlockingUnaryCall <TRequest, TResponse>(Call <TRequest, TResponse> call, TRequest req, CancellationToken token) where TRequest : class where TResponse : class { var asyncCall = new AsyncCall <TRequest, TResponse>(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); // TODO(jtattermusch): this gives a race that cancellation can be requested before the call even starts. RegisterCancellationCallback(asyncCall, token); return(asyncCall.UnaryCall(call.Channel, call.Name, req, call.Headers)); }
public void Init() { channel = new Channel("localhost", Credentials.Insecure); fakeCall = new FakeNativeCall(); var callDetails = new CallInvocationDetails <string, string>(channel, "someMethod", null, Marshallers.StringMarshaller, Marshallers.StringMarshaller, new CallOptions()); asyncCall = new AsyncCall <string, string>(callDetails, fakeCall); }
private IEnumerator<IAsyncCall> SendReceive(string host, int port) { AsyncCall<IPHostEntry> call = new AsyncCall<IPHostEntry>(); yield return call .WaitOn(cb => Dns.BeginGetHostEntry(host, cb, null)) & Dns.EndGetHostEntry; if (!call.Succeeded) { Console.WriteLine(call.Exception.Message); yield break; } IPAddress addr = call.Result.AddressList[0]; Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); AsyncCall call2 = new AsyncCall(); yield return call2 .WaitOn(cb => socket.BeginConnect(new IPEndPoint(addr, port), cb, null)) & socket.EndConnect; if (!call2.Succeeded) { Console.WriteLine(call2.Exception.Message); yield break; } byte[] sendBuffer = System.Text.Encoding.ASCII.GetBytes("hello world"); byte[] receiveBuffer = new byte[1024]; AsyncCall<int> call3 = new AsyncCall<int>(); for (int i = 0; i < 128; ++i) { yield return call3 .WaitOn(cb => socket.BeginSend( sendBuffer, 0, sendBuffer.Length, SocketFlags.None, cb, null)) & socket.EndSend; int bytesSent = call3.Result; Console.WriteLine("{0} sent {1} bytes", socket.LocalEndPoint, bytesSent); if (bytesSent > 0) { yield return call3 .WaitOn(cb => socket.BeginReceive( receiveBuffer, 0, receiveBuffer.Length, SocketFlags.None, cb, null)) & socket.EndReceive; Console.WriteLine("{0} read {1} bytes", socket.LocalEndPoint, call3.Result); } } Console.WriteLine("closing socket {0}", socket.LocalEndPoint); socket.Close(); }
IEnumerator<IAsyncCall> DatabaseTask() { button1.Enabled = false; AsyncCall<int> call = new AsyncCall<int>(); Func slow = new Func(DarnSlowDatabaseCall); yield return call.WaitOn(cb => slow.BeginInvoke(cb, null)) & slow.EndInvoke; textBox1.Text = "db task returned " + call.Result + "\r\n"; button1.Enabled = true; }
public static void Execute(AsyncCall call, DynamoDBAsyncResult result) { try { result.Return = call(); } catch (Exception e) { result.LastException = e; result.Return = null; } finally { result.SignalWaitHandle(); if (result.Callback != null) { result.Callback(result); } } }
private static IEnumerator<IAsyncCall> Listen(int port) { IPEndPoint endPoint = new IPEndPoint(IPAddress.Any, port); Socket sock = new Socket(endPoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp); sock.Bind(endPoint); sock.Listen(2058); Console.WriteLine("waiting for connections"); AsyncCall<Socket> call = new AsyncCall<Socket>(); while (true) { yield return call.WaitOn(cb => sock.BeginAccept(cb, null)) & sock.EndAccept; Socket client = call.Result; Console.WriteLine("accepted client {0}", client.RemoteEndPoint); TaskManager.AddTask(Echo(client)); } }
public WorkItemExecutionMethod(AsyncCall owner, Action call) : base(owner) { this.call = call; }
protected WorkItemExecutionMethodBase(AsyncCall owner) { this.owner = owner; }
public static IAsyncResult BeginOperation(AsyncCall call, AsyncCallback callback, object state) { DynamoDBAsyncResult result = new DynamoDBAsyncResult(callback, state); new Thread(() => Execute(call, result)).Start(); return result; }
static void AssertStreamingResponseError(AsyncCall<string, string> asyncCall, FakeNativeCall fakeCall, Task<bool> moveNextTask, StatusCode expectedStatusCode) { Assert.IsTrue(moveNextTask.IsCompleted); Assert.IsTrue(fakeCall.IsDisposed); var ex = Assert.ThrowsAsync<RpcException>(async () => await moveNextTask); Assert.AreEqual(expectedStatusCode, ex.Status.StatusCode); Assert.AreEqual(expectedStatusCode, asyncCall.GetStatus().StatusCode); Assert.AreEqual(0, asyncCall.GetTrailers().Count); }
public static IAsyncResult BeginOperation(AsyncCall call, AsyncCallback callback, object state) { DynamoDBAsyncResult result = new DynamoDBAsyncResult(callback, state); ThreadPool.QueueUserWorkItem(s => Execute(call, result)); return result; }
static void AssertStreamingResponseSuccess(AsyncCall<string, string> asyncCall, FakeNativeCall fakeCall, Task<bool> moveNextTask) { Assert.IsTrue(moveNextTask.IsCompleted); Assert.IsTrue(fakeCall.IsDisposed); Assert.IsFalse(moveNextTask.Result); Assert.AreEqual(Status.DefaultSuccess, asyncCall.GetStatus()); Assert.AreEqual(0, asyncCall.GetTrailers().Count); }
static void AssertUnaryResponseSuccess(AsyncCall<string, string> asyncCall, FakeNativeCall fakeCall, Task<string> resultTask) { Assert.IsTrue(resultTask.IsCompleted); Assert.IsTrue(fakeCall.IsDisposed); Assert.AreEqual(Status.DefaultSuccess, asyncCall.GetStatus()); Assert.AreEqual(0, asyncCall.ResponseHeadersAsync.Result.Count); Assert.AreEqual(0, asyncCall.GetTrailers().Count); Assert.AreEqual("response1", resultTask.Result); }
static void AssertUnaryResponseError(AsyncCall<string, string> asyncCall, FakeNativeCall fakeCall, Task<string> resultTask, StatusCode expectedStatusCode) { Assert.IsTrue(resultTask.IsCompleted); Assert.IsTrue(fakeCall.IsDisposed); Assert.AreEqual(expectedStatusCode, asyncCall.GetStatus().StatusCode); var ex = Assert.ThrowsAsync<RpcException>(async () => await resultTask); Assert.AreEqual(expectedStatusCode, ex.Status.StatusCode); Assert.AreEqual(0, asyncCall.ResponseHeadersAsync.Result.Count); Assert.AreEqual(0, asyncCall.GetTrailers().Count); }