title: Alamofire: [Result]: FAILURE: Error Domain=NSURLErrorDomain Code=-999 "cancelled"
body: <p>The service I'm connecting to is using a self signed certificate. 
  For dev purposes I do not want to validate that chain. </p>
  
  <p>Using swift 3 with Alamofire 4. 
  Fixed the ATS accordingly:</p>
  
  <pre><code>&lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
  &lt;dict&gt;
      &lt;key&gt;NSExceptionDomains&lt;/key&gt;
      &lt;dict&gt;
          &lt;key&gt;url.com&lt;/key&gt;
          &lt;dict&gt;
              &lt;key&gt;NSExceptionAllowsInsecureHTTPLoads&lt;/key&gt;
              &lt;true/&gt;
              &lt;key&gt;NSExceptionRequiresForwardSecrecy&lt;/key&gt;
              &lt;false/&gt;
              &lt;key&gt;NSIncludesSubdomains&lt;/key&gt;
              &lt;true/&gt;
          &lt;/dict&gt;
      &lt;/dict&gt;
  &lt;/dict&gt;
  </code></pre>
  
  <p>Code to connect and disable evaluation. </p>
  
  <pre><code>    let serverTrustPolicies: [String: ServerTrustPolicy] = [
          "example.domain.com": .pinCertificates(
              certificates: ServerTrustPolicy.certificates(),
              validateCertificateChain: false,
              validateHost: true
          ),
          "sub.url.com": .disableEvaluation
      ]
  
      let sessionManager = Alamofire.SessionManager(
          serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies)
      )
  
      let headers = ["Authorization": "Basic /*...*/"]
  
      sessionManager.request("https://sub.url.com/path", headers: headers).responseJSON { response in
          print(response.request)  // original URL request
          print(response.response) // HTTP URL response
          print(response.data)     // server data
          print(response.result)   // result of response serialization
  
          debugPrint(response)
  
          if let JSON = response.result.value {
              print("JSON: \(JSON)")
          }
      }
  </code></pre>
  
  <p>Error log from dumpPrint</p>
  
  <blockquote>
    <p>[Result]: FAILURE: Error Domain=NSURLErrorDomain Code=-999 "cancelled"
    UserInfo={NSErrorFailingURLKey=<a href="https://sub.url.com/path" rel="noreferrer">https://sub.url.com/path</a>,
    NSLocalizedDescription=cancelled, 
    NSErrorFailingURLStringKey=<a href="https://sub.url.com/path" rel="noreferrer">https://sub.url.com/path</a>}</p>
  </blockquote>
  
  <p>URL has been masked. </p>