/// <summary>
        /// Processes the WWKS 2.0 protocol handshake to initialize the connection to the digital shelf.
        /// </summary>
        private bool ProcessHandshake()
        {
            HelloRequestEnvelope request = new HelloRequestEnvelope()
            {
                HelloRequest = new HelloRequest()
                {
                    Id         = MessageId.Next, //TODO: Don't use static message id generator but create instance.
                    Subscriber = new Subscriber()
                    {
                        Id           = SubscriberID,
                        Type         = SubscriberType.IMS,
                        Manufacturer = "CareFusion Germany 326 GmbH",
                        ProductInfo  = "StorageSystem Library",
                        VersionInfo  = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion,
                        Capability   = Capabilities
                    }
                }
            };

            if (_messageObjectStream.Write(request) == false)
            {
                this.Error("Sending the initial 'HelloRequest' message failed!");
                return(false);
            }

            object response = _messageObjectStream.Read(HandshakeTimeout);

            if (response == null)
            {
                this.Error("Waiting for the message 'HelloResponse' failed.");
                return(false);
            }

            if (response.GetType() != typeof(HelloResponseEnvelope))
            {
                this.Error("Received unexpected message of type '{0}'.", response.GetType().Name);
                return(false);
            }

            HelloResponseEnvelope resp = (HelloResponseEnvelope)response;

            if (resp.HelloResponse.Subscriber == null)
            {
                this.Error("Received a 'HelloResponse' message with invalid subscriber information.");
                return(false);
            }

            if (resp.HelloResponse.Id != request.HelloRequest.Id)
            {
                this.Error("Received a 'HelloResponse' message with invalid message identifier.");
                return(false);
            }

            _destinationCapabilities = resp.HelloResponse.Subscriber.Capability;

            this.Info("WWKS 2.0 protocol handshake successfully finished -> ID='{0}' Type='{1}' " +
                      "Manufacturer='{2}' ProductInfo='{3}' VersionInfo='{4}'.",
                      resp.HelloResponse.Subscriber.Id, resp.HelloResponse.Subscriber.Type.ToString(),
                      string.IsNullOrEmpty(resp.HelloResponse.Subscriber.Manufacturer) ? string.Empty : resp.HelloResponse.Subscriber.Manufacturer,
                      string.IsNullOrEmpty(resp.HelloResponse.Subscriber.ProductInfo) ? string.Empty : resp.HelloResponse.Subscriber.ProductInfo,
                      string.IsNullOrEmpty(resp.HelloResponse.Subscriber.VersionInfo) ? string.Empty : resp.HelloResponse.Subscriber.VersionInfo);

            _destinationId = resp.HelloResponse.Subscriber.Id;
            return(true);
        }
        /// <summary>
        /// Processes the WWKS 2.0 protocol handshake with Robot role.
        /// </summary>
        /// <returns><c>true</c> if protocol handshake finished successfully;<c>false</c> otherwise.</returns>
        private bool ProcessRobotProtocolHandshake()
        {
            this.Info("Converter '{0}' is running in Robot mode.", _converterID);

            object request = _objectStream.Read(_configuration.HandshakeTimeout);

            _objectStream.EnableMessageEcho = _configuration.EnableMessageEcho;

            if (request == null)
            {
                this.Error("Waiting for hello request failed!");
                return(false);
            }

            if (request.GetType() != typeof(HelloRequestEnvelope))
            {
                this.Error("Received unexpected message of type '{0}'.", request.GetType().Name);
                return(false);
            }

            HelloRequestEnvelope req = (HelloRequestEnvelope)request;

            if (req.HelloRequest.Subscriber == null)
            {
                this.Error("Received hello request with invalid subscriber information.");
                return(false);
            }

            HelloResponseEnvelope response = new HelloResponseEnvelope()
            {
                HelloResponse = new HelloResponse()
                {
                    Id         = req.HelloRequest.Id,
                    Subscriber = new Types.Subscriber()
                    {
                        Id           = _configuration.SubscriberID,
                        Type         = Types.SubscriberType.Robot,
                        Manufacturer = VersionInfoProvider.Company,
                        ProductInfo  = VersionInfoProvider.Product,
                        VersionInfo  = VersionInfoProvider.FileVersion,
                        Capability   = MosaicCapabilities
                    }
                }
            };

            if (_objectStream.Write(response) == false)
            {
                this.Error("Sending hello response failed!");
                return(false);
            }

            this.Info("WWKS 2.0 protocol handshake successfully finished -> ID='{0}' Type='{1}' " +
                      "Manufacturer='{2}' ProductInfo='{3}' VersionInfo='{4}'.",
                      req.HelloRequest.Subscriber.Id, req.HelloRequest.Subscriber.Type.ToString(),
                      string.IsNullOrEmpty(req.HelloRequest.Subscriber.Manufacturer) ? string.Empty : req.HelloRequest.Subscriber.Manufacturer,
                      string.IsNullOrEmpty(req.HelloRequest.Subscriber.ProductInfo) ? string.Empty : req.HelloRequest.Subscriber.ProductInfo,
                      string.IsNullOrEmpty(req.HelloRequest.Subscriber.VersionInfo) ? string.Empty : req.HelloRequest.Subscriber.VersionInfo);

            UpdateSupportedMessageList(req.HelloRequest.Subscriber.Capability);
            _destinationID = req.HelloRequest.Subscriber.Id;
            _tenantID      = string.IsNullOrEmpty(req.HelloRequest.Subscriber.TenantId) ? string.Empty : req.HelloRequest.Subscriber.TenantId;
            return(true);
        }