public Message Execute(Message message, TimeSpan timeout)
        {
            System.Diagnostics.Debug.WriteLine(
                "Sending an outbound message",
                "TransMock.Wcf.Adapter.MockAdapterOutboundHandler");

            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            XmlDictionaryReader xdr = message.GetReaderAtBodyContents();

            System.Diagnostics.Debug.WriteLine("Reading the message body in base64 encoding");

            // Reading the message contents as a base64 encoded string
            if (xdr.NodeType == XmlNodeType.Element)
            {
                // In case the content is nested in an element under the Body element
                xdr.Read();
            }

            byte[] msgBuffer = xdr.ReadContentAsBase64();

            using (StreamingNamedPipeClient pipeClient = new StreamingNamedPipeClient(
                       Connection.ConnectionFactory.ConnectionUri.Uri))
            {
                pipeClient.Connect((int)timeout.TotalMilliseconds);

                System.Diagnostics.Debug.WriteLine(
                    "The pipe client was connected!Sending the outbound message over the pipe",
                    "TransMock.Wcf.Adapter.MockAdapterOutboundHandler");

                pipeClient.WriteAllBytes(msgBuffer);

                System.Diagnostics.Debug.WriteLine(
                    "Outbound message sent!",
                    "TransMock.Wcf.Adapter.MockAdapterOutboundHandler");

                // Check if the IsSolicitResponse context property is present and set to true
                bool   isTwoWay = false;
                object isSolicitResponseValue;

                if (message.Properties.TryGetValue(
                        "http://schemas.microsoft.com/BizTalk/2003/system-properties#IsSolicitResponse",
                        out isSolicitResponseValue))
                {
                    isTwoWay = Convert.ToBoolean(
                        isSolicitResponseValue,
                        CultureInfo.InvariantCulture);
                }

                // Check if the CorrelationToken prometed property is present
                if (isTwoWay)
                {
                    // We are in a two-way communication scenario
                    System.Diagnostics.Debug.WriteLine(
                        "Two-way communication - reading the response message",
                        "TransMock.Wcf.Adapter.MockAdapterOutboundHandler");

                    string respContents = null;

                    // We proceed with waiting for the response
                    Message responseMsg = null;
                    using (MemoryStream msgStream = pipeClient.ReadStream() as MemoryStream)
                    {
                        respContents = string.Format(
                            CultureInfo.InvariantCulture,
                            "<MessageContent>{0}</MessageContent>",
                            Convert.ToBase64String(msgStream.ToArray()));

                        XmlReader respReader = XmlReader.Create(new StringReader(respContents));

                        System.Diagnostics.Debug.WriteLine(
                            "Constructing the response WCF Message",
                            "TransMock.Wcf.Adapter.MockAdapterOutboundHandler");

                        responseMsg = Message.CreateMessage(MessageVersion.Default, string.Empty, respReader);
                    }

                    System.Diagnostics.Debug.WriteLine(
                        "Response WCF Message constructed. Returning it to BizTalk",
                        "TransMock.Wcf.Adapter.MockAdapterOutboundHandler");

                    return(responseMsg);
                }
                else
                {
                    // Return empty message in one-way scenario
                    return(Message.CreateMessage(MessageVersion.Default, string.Empty));
                }
            }
        }