public override void Connect()
        {
            if (ServiceConnectionState != ConnectionState.Initial)
            {
                Logger.Current.AddMessage("Already connecting; not trying to connect again: " + ServiceConnectionState);
                return; // don't try to connect again while connected
            }

            if (!(ServiceConfig is NetcastTvServiceConfig))
            {
                ServiceConfig = new NetcastTvServiceConfig(ServiceConfig.ServiceUuid);
            }

            if (DiscoveryManager.GetInstance().PairingLevel != DiscoveryManager.PairingLevelEnum.On) return;

            if (!string.IsNullOrEmpty(((NetcastTvServiceConfig)ServiceConfig).PairingKey))
            {
                SendPairingKey(((NetcastTvServiceConfig)ServiceConfig).PairingKey);
            }
            else
            {
                ShowPairingKeyOnTv();
            }
        }
        public override void SendPairingKey(string pairingKey)
        {
            ServiceConnectionState = ConnectionState.Pairing;

            if (!(ServiceConfig is NetcastTvServiceConfig))
            {
                ServiceConfig = new NetcastTvServiceConfig(ServiceConfig.ServiceUuid);
            }

            var responseListener = new ResponseListener
            (
                loadEventArg =>
                {
                    ServiceConnectionState = ConnectionState.Paired;
                    ((NetcastTvServiceConfig)ServiceConfig).PairingKey = pairingKey;
                    ConnectSuccess();
                },
                serviceCommandError =>
                {
                    ServiceConnectionState = ConnectionState.Initial;

                    if (Listener != null)
                        Listener.OnConnectionFailure(this, new Exception(serviceCommandError.ToString()));
                }
            );

            var requestUrl = GetUdapRequestUrl(UdapPathPairing);

            var ps = new Dictionary<string, string>
            {
                {"name", "hello"},
                {"value", pairingKey},
                {"port", ServiceDescription.Port.ToString()}
            };

            var httpMessage = GetUdapMessageBody(UdapApiPairing, ps);

            var command = new ServiceCommand(this, requestUrl,
                httpMessage, responseListener);
            command.Send();
        }