void ResourceHosting::discoverHandler(RemoteObjectPtr remoteResource)
{
    std::string discoverdUri = remoteResource->getUri();
    if(discoverdUri.compare(
            discoverdUri.size()-HOSTING_TAG_SIZE, HOSTING_TAG_SIZE, HOSTING_TAG) != 0)
    {
        return;
    }

    HostingObjectPtr foundHostingObject = findRemoteResource(remoteResource);
    if(foundHostingObject == nullptr)
    {
        try
        {
            foundHostingObject = std::make_shared<HostingObject>();
            foundHostingObject->initializeHostingObject(remoteResource,
                    std::bind(&ResourceHosting::destroyedHostingObject, this,
                            HostingObjectWeakPtr(foundHostingObject)));
            hostingObjectList.push_back(foundHostingObject);
        }catch(const RCSInvalidParameterException &e)
        {
            OIC_HOSTING_LOG(DEBUG,
                    "[ResourceHosting::discoverHandler]InvalidParameterException:%s", e.what());
        }
    }
}
        void ResourceHosting::discoveryHandler(RemoteObjectPtr remoteResource)
        {
            std::cout << "ResourceHosting: Discovered device with uri: " << remoteResource->getUri() << std::endl;
            auto discoverdUri = remoteResource->getUri();
            if (discoverdUri.compare(
                    discoverdUri.size()-HOSTING_TAG_SIZE, HOSTING_TAG_SIZE, HOSTING_TAG) != 0)
            {
                return;
            }

            auto foundHostingObject = findRemoteResource(remoteResource);
            if (foundHostingObject != nullptr) return;

            try
            {
                HostingObjectKey key = generateHostingObjectKey(remoteResource);
                foundHostingObject = HostingObject::createHostingObject(remoteResource,
                        std::bind(&ResourceHosting::destroyedHostingObject, this, key));

                RHLock lock(m_mutexForList);
                m_hostingObjects.insert(std::make_pair(key, foundHostingObject));

            } catch (const RCSException & e)
            {
                OIC_HOSTING_LOG(DEBUG,
                        "[ResourceHosting::discoverHandler]InvalidParameterException:%s", e.what());
            }
        }