Microsoft.Protocols.TestTools.StackSdk.BranchCache.Pchc.PCHCClient.SendByte C# (CSharp) Method

SendByte() private method

Send the byte array of PCHC message using https transport .
private SendByte ( byte httpRequestPayload ) : RESPONSE_MESSAGE
httpRequestPayload byte The http request payload.
return RESPONSE_MESSAGE
        private RESPONSE_MESSAGE SendByte(byte[] httpRequestPayload)
        {
            // Set the timeout of http.
            int timeout = 20000;
            byte[] payloadBuffer = null;
            HttpWebResponse httpWebResponse;

            this.httpClientTransport.Send(HttpVersion.Version10, null, httpRequestPayload, HttpMethod.POST, timeout);

            try
            {
                httpWebResponse = this.httpClientTransport.Receive(ref payloadBuffer);
            }
            catch (WebException e)
            {
                if (e.Message.Contains(HttpStatusCode.Unauthorized.ToString()))
                {
                    throw new HttpStatusCode401Exception();
                }
                else if (e.Message.ToLower().Contains("timed out".ToLower()))
                {
                    throw new NoRESPONSEMESSAGEException();
                }
                else
                {
                    // Un expected exception is received.
                    throw;
                }
            }

            this.httpResponseMethod = httpWebResponse.Method;

            this.httpResponseUri = httpWebResponse.ResponseUri;

            if (payloadBuffer == null)
            {
                throw new NoRESPONSEMESSAGEException();
            }

            try
            {
                this.responseMessage = DecodeMessage.DecodeResponseMessage(payloadBuffer);
            }
            catch (ArgumentOutOfRangeException e)
            {
                throw new NoRESPONSEMESSAGEException(e.Message);
            }

            return this.responseMessage;
        }