/// <summary>
        /// Creates a SearchResultReference. For LDAP v3 only.
        /// </summary>
        /// <param name="context">The user context which contains message ID.</param>
        /// <param name="referenceUrls">The referenced URL.</param>
        /// <returns>The packet that contains the response.</returns>
        internal override AdtsSearchResultReferencePacket CreateSearchResultReference(
            AdtsLdapContext context,
            string[] referenceUrls)
        {
            int length = (referenceUrls != null) ? referenceUrls.Length : 0;

            LDAPURL[] ldapUrlArray = new LDAPURL[length];
            for (int i = 0; i < length; i++)
            {
                ldapUrlArray[i] = new LDAPURL(referenceUrls[i]);
            }
            SearchResultReference reference = new SearchResultReference(ldapUrlArray);

            LDAPMessage_protocolOp operation = new LDAPMessage_protocolOp();
            operation.SetData(LDAPMessage_protocolOp.searchResRef, reference);

            LDAPMessage message = new LDAPMessage(new MessageID(context.MessageId), operation, null);
            AdtsSearchResultReferencePacket packet = new AdtsSearchResultReferencePacket();
            packet.ldapMessagev3 = message;
            packet.messageId = context.MessageId;

            return packet;
        }
        /// <summary>
        /// Creates a Referral object from a list of reference URLs.
        /// </summary>
        /// <param name="referrals">Reference URLs.</param>
        /// <returns>The referral object. If the refUrls is null, return null.</returns>
        private Referral CreateReferral(string[] refUrls)
        {
            if (refUrls == null)
            {
                return null;
            }

            int length = refUrls.Length;
            LDAPURL[] ldapUrls = new LDAPURL[length];
            for (int i = 0; i < length; i++)
            {
                ldapUrls[i] = new LDAPURL(refUrls[i]);
            }

            Referral referral = new Referral(ldapUrls);

            return referral;
        }