/// <summary>
        /// Receive push notification on the specified port.
        /// </summary>
        /// <param name="addressFamily">Specifies which IP family to use.</param>
        /// <returns>The opaque data received from server.</returns>
        private string GetPushNotification(Add_Families addressFamily)
        {
            string opaque = null;
            int port = int.Parse(Common.GetConfigurationPropertyValue("NotificationPort", this.Site));

            using (UdpClient udpClient = new UdpClient(port, addressFamily == Add_Families.AF_INET ? System.Net.Sockets.AddressFamily.InterNetwork : System.Net.Sockets.AddressFamily.InterNetworkV6))
            {
                udpClient.Client.ReceiveTimeout = int.Parse(Common.GetConfigurationPropertyValue("ReceiveTimeout", this.Site));

                IPEndPoint remote = new IPEndPoint(IPAddress.Any, 0);
                byte[] data;
                try
                {
                    data = udpClient.Receive(ref remote);
                    opaque = System.Text.Encoding.ASCII.GetString(data).Replace("\0", string.Empty);
                    return opaque;
                }
                catch (SocketException exception)
                {
                    Site.Assert.Fail("Failed to receive the push notification. The error message is {0}.", exception.Message);
                    return string.Empty;
                }
            }
        }
        /// <summary>
        /// The method EcRRegisterPushNotification registers a callback address with the server for a Session Context. 
        /// </summary>
        /// <param name="pcxh">A unique value to be used as a CXH.</param>
        /// <param name="rgbContext">This parameter contains opaque client-generated context data that is sent back to the client at the callback address.</param>
        /// <param name="addType">The type of the cbCallbackAddress.</param>
        /// <param name="ip">The client IP used in this method.</param>
        /// <param name="notificationHandle">If the call completes successfully, this output parameter will contain a handle to the notification callback on the server.</param>
        /// <returns>If success, it returns 0, else returns the error code.</returns>
        public uint EcRRegisterPushNotification(ref IntPtr pcxh, byte[] rgbContext, Add_Families addType, string ip, out uint notificationHandle)
        {
            notificationHandle = 0;
            uint retValue = 0;
            ushort clientContextSize = (ushort)(rgbContext == null ? 0 : rgbContext.Length);

            try
            {
                ushort port = ushort.Parse(Common.GetConfigurationPropertyValue("NotificationPort", this.Site)); 
                IntPtr oldPcxh = pcxh;
                retValue = NativeMethods.EcRRegisterPushNotificationWrap(
                    ref pcxh,
                    (short)addType,
                    ip,
                    port,
                    rgbContext,
                    clientContextSize,
                    out notificationHandle);
                this.VerifyEcRRegisterPushNotification(pcxh, retValue, oldPcxh);
            }
            catch (SEHException e)
            {
                retValue = NativeMethods.RpcExceptionCode(e);
            }

            return retValue;
        }