     }
   }
 }
+
+extension PactVerificationService: URLSessionDelegate {
+  public func urlSession(_ session: URLSession,
+                         didReceive challenge: URLAuthenticationChallenge,
+                         completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
+    guard challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust,
+        allowInsecureCertificates,
+        let serverTrust = challenge.protectionSpace.serverTrust else {
+            completionHandler(.performDefaultHandling, nil)
+            return
+    }
+
+    let proposedCredential = URLCredential(trust: serverTrust)
+    completionHandler(.useCredential, proposedCredential)
+  }
+}

import Foundation
import BrightFutures

open class PactVerificationService {
  public let url: String
  public let port: Int
  open var baseUrl: String {
    return "\(url):\(port)"
  }

    }
  }

  public init(url: String = "http://localhost", port: Int = 1234, allowInsecureCertificates: Bool = false) {
    self.url = url
    self.port = port
    self.allowInsecureCertificates = allowInsecureCertificates

    super.init()
    Router.baseURLString = baseUrl
  }

