public Task <System.Int32> Sum(System.Int32 x, System.Int32 y, object asyncState = null)
            {
                var taskSource_ = new TaskCompletionSource <System.Int32>(asyncState);

                //构建请求发送buffer
                int seqID_      = this.client_.NextRequestSeqID();
                var sendBuffer_ = ThriftMarshaller.Serialize(new TMessage("Sum", TMessageType.Call, seqID_),
                                                             new Service1.Sum_args()
                {
                    X = x, Y = y
                });

                //开始异步发送
                this.client_.Send("Example.Service.Thrift.Service1+Iface", "Sum", seqID_, sendBuffer_, (ex_) =>
                {
                    //处理异常回调
                    taskSource_.SetException(ex_);
                },
                                  (payload_) =>
                {
                    if (payload_ == null || payload_.Length == 0)
                    {
                        taskSource_.SetException(new TApplicationException(
                                                     TApplicationException.ExceptionType.MissingResult, "Sum failed: Did not receive any data."));
                        return;
                    }

                    TMessage recvMsg_;
                    TApplicationException exServer_ = null;
                    Service1.Sum_result result_     = null;

                    var oproto_ = ThriftMarshaller.GetBinaryProtocol(payload_);
                    try
                    {
                        //read TMessage
                        recvMsg_ = oproto_.ReadMessageBegin();
                        //read server return exception
                        if (recvMsg_.Type == TMessageType.Exception)
                        {
                            exServer_ = TApplicationException.Read(oproto_);
                        }
                        else
                        {
                            //read result
                            result_ = new Service1.Sum_result();
                            result_.Read(oproto_);
                        }
                    }
                    catch (System.Exception ex_)
                    {
                        oproto_.Transport.Close();
                        taskSource_.SetException(ex_);
                        return;
                    }
                    oproto_.Transport.Close();

                    if (exServer_ != null)
                    {
                        taskSource_.SetException(exServer_);
                    }
                    else
                    {
                        if (result_.__isset.success)
                        {
                            taskSource_.SetResult(result_.Success);
                            return;
                        }

                        taskSource_.SetException(new TApplicationException(
                                                     TApplicationException.ExceptionType.MissingResult, "Sum failed: unknown result"));
                    }
                });

                return(taskSource_.Task);
            }
                        public Task<System.Int32> Sum(System.Int32 x, System.Int32 y, object asyncState = null)
            {
                var taskSource_ = new TaskCompletionSource<System.Int32>(asyncState);

                //构建请求发送buffer
                int seqID_ = this.client_.NextRequestSeqID();
                var sendBuffer_ = ThriftMarshaller.Serialize(new TMessage("Sum", TMessageType.Call, seqID_),
                    new Service1.Sum_args()
                    {
                        X = x, Y = y
                    });

                //开始异步发送
                this.client_.Send("Example.Service.Thrift.Service1+Iface", "Sum", seqID_, sendBuffer_, (ex_) =>
                {
                    //处理异常回调
                    taskSource_.SetException(ex_);
                },
                (payload_) =>
                {
                    if (payload_ == null || payload_.Length == 0)
                    {
                        taskSource_.SetException(new TApplicationException(
                            TApplicationException.ExceptionType.MissingResult, "Sum failed: Did not receive any data."));
                        return;
                    }

                    TMessage recvMsg_;
                    TApplicationException exServer_ = null;
                    Service1.Sum_result result_ = null;

                    var oproto_ = ThriftMarshaller.GetBinaryProtocol(payload_);
                    try
                    {
                        //read TMessage
                        recvMsg_ = oproto_.ReadMessageBegin();
                        //read server return exception
                        if (recvMsg_.Type == TMessageType.Exception)
                            exServer_ = TApplicationException.Read(oproto_);
                        else
                        {
                            //read result
                            result_ = new Service1.Sum_result();
                            result_.Read(oproto_);
                        }
                    }
                    catch (System.Exception ex_)
                    {
                        oproto_.Transport.Close();
                        taskSource_.SetException(ex_);
                        return;
                    }
                    oproto_.Transport.Close();

                    if (exServer_ != null)
                        taskSource_.SetException(exServer_);
                    else
                    {
                        if (result_.__isset.success)
                        {
                            taskSource_.SetResult(result_.Success);
                            return;
                        }
						
                        taskSource_.SetException(new TApplicationException(
                            TApplicationException.ExceptionType.MissingResult, "Sum failed: unknown result"));
                    }
                });

                return taskSource_.Task;
            }