public static AsyncFuture <TPacket> Get(Action <IAsyncContext <TPacket> > completedCallback)
        {
            AsyncFuture <TPacket> future = null;

            lock (_innerLock)
            {
                if (_queues.Count > 0)
                {
                    future = _queues.Dequeue();
                }
                else
                {
                    future = new AsyncFuture <TPacket>();
                    _seed++;
                    future.Id = _seed;
                }
                _pendings[future.Id] = future;
            }

            if (future.CompletedHandler != null)
            {
                future.CompletedHandler = null;
            }
            future.CompletedHandler = completedCallback;

            Current = future;
            return(future);
        }
        public static void OnCompleted(TPacket resp)
        {
            AsyncFuture <TPacket> future = null;

            lock (_innerLock)
            {
                if (_pendings.ContainsKey(resp.Id))
                {
                    future = _pendings[resp.Id];
                    _pendings.Remove(resp.Id);
                }
            }

            Current = future;
            if (future != null)
            {
                future.Packet = resp;
                future.Set();
            }
        }