/// <summary>
        /// Resolves the header package.
        /// </summary>
        /// <param name="packageData">The package data.</param>
        /// <returns></returns>
        public override TPackageInfo ResolvePackage(IList <ArraySegment <byte> > packageData)
        {
            string headerData = Encoding.ASCII.GetString(packageData);

            var header = new HttpHeaderInfo();

            MimeHeaderHelper.ParseHttpHeader(headerData, header);

            var nextReceiveFilter = GetBodyReceiveFilter(header, packageData.Sum(d => d.Count));

            if (nextReceiveFilter != null)
            {
                NextReceiveFilter = nextReceiveFilter;
                return(default(TPackageInfo));
            }

            return(ResolveHttpPackageWithoutBody(header));
        }
        /// <summary>
        /// Resolves the package binary data to package instance
        /// </summary>
        /// <param name="bufferStream">The received buffer stream.</param>
        /// <returns>the resolved package instance</returns>
        public override TPackageInfo ResolvePackage(IBufferStream bufferStream)
        {
            var length = (int)bufferStream.Length;

            string headerData = bufferStream.ReadString(length, HeaderEncoding);

            var header = new HttpHeaderInfo();

            MimeHeaderHelper.ParseHttpHeader(headerData, header);

            var nextReceiveFilter = GetBodyReceiveFilter(header, length);

            if (nextReceiveFilter != null)
            {
                NextReceiveFilter = nextReceiveFilter;
                return(default(TPackageInfo));
            }

            return(ResolveHttpPackageWithoutBody(header));
        }