/**
         * <summary>
         * Wraps task request into a protocol message.</summary>
         *
         * <param name="req">Task request that need to be wrapped.</param>
         * <returns>Wrapped message.</returns>
         */
        private static ProtoRequest WrapTaskRequest(GridClientTaskRequest req)
        {
            Object args = req.Argument;

            ProtoTaskRequest.Builder builder = ProtoTaskRequest.CreateBuilder()
                                               .SetTaskName(req.TaskName)
                                               .SetArgument(WrapObject(args));

            return(WrapRequest(req, builder.Build()));
        }
        /** <inheritdoc/> */
        override public IGridClientFuture <T> Execute <T>(String taskName, Object arg, Guid destNodeId)
        {
            GridClientTaskRequest msg = new GridClientTaskRequest(destNodeId);

            msg.TaskName = taskName;
            msg.Argument = arg;

            IGridClientFuture <GridClientTaskResultBean> fut = makeRequest <GridClientTaskResultBean>(msg);

            return(new GridClientFinishedFuture <T>(() => (T)fut.Result.Result));
        }
        /**
         * <summary>
         * Wraps task request into a protocol message.</summary>
         *
         * <param name="req">Task request that need to be wrapped.</param>
         * <returns>Wrapped message.</returns>
         */
        private static GridClientTaskRequest WrapTaskRequest(ProtoRequest req)
        {
            ProtoTaskRequest data = ProtoTaskRequest.ParseFrom(req.Body);

            GridClientTaskRequest bean = new GridClientTaskRequest(Guid.Empty);

            bean.TaskName = data.TaskName;
            bean.Argument = WrapObject(data.Argument);

            return(WrapRequest(bean, req));
        }