Symptoms
Unable to connect to SmartObjectService REST endpoint - 401 not authenticated error with custom related code
Diagnoses
Changes needed to be made on your code: Network authentication type (See below)
Resolution
cache.Add(new Uri(url), "Basic", new NetworkCredential(user, password))
to:
cache.Add(new Uri(url), "Negotiate", new NetworkCredential(user, password))
Here is the related article that could assisted as well
https://msdn.microsoft.com/en-us/library/59x2s2s6(v=vs.110).aspx