 extension SessionDelegate {
     public typealias SessionDidBecomeInvalid                   = ((URLSession, Error?) -> Swift.Void)
     public typealias SessionDidReceiveChallenge                = ((URLSession, URLAuthenticationChallenge, (@escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Swift.Void)) -> Swift.Void)
+    public typealias SessionDidFinishedEvents                  = ((URLSession) -> Swift.Void)
     public typealias TaskOfSessionWillPerformHTTPRedirection   = ((URLSessionTask, URLSession, HTTPURLResponse, URLRequest, @escaping (URLRequest?) -> Swift.Void) -> Swift.Void)
     public typealias TaskOfSessionDidReceiveChallenge          = ((URLSessionTask, URLSession, URLAuthenticationChallenge, @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Swift.Void) -> Swift.Void)
     public typealias TaskOfSessionNeedNewBodyStream            = ((URLSessionTask, URLSession, @escaping (InputStream?) -> Swift.Void) -> Swift.Void)

    /// - Parameters:
    ///   - session:    The session containing the stream task that closed reads.
    ///   - streamTask: The stream task that closed reads.
    public func urlSession(_ session: URLSession, readClosedFor streamTask: URLSessionStreamTask) {
        streamTaskOfSessionReadClosed?(streamTask, session)
    }

        // Performing default handling without credential.
        completionHandler(.performDefaultHandling, nil)
    }
#if !os(macOS)
    /// Tells the delegate that all messages enqueued for a session have been delivered.
    /// In iOS, when a background transfer completes or requires credentials, if your app is no longer running, your app is automatically relaunched in the background, and the app’s UIApplicationDelegate is sent an application(_:handleEventsForBackgroundURLSession:completionHandler:) message. This call contains the identifier of the session that caused your app to be launched. Your app should then store that completion handler before creating a background configuration object with the same identifier, and creating a session with that configuration. The newly created session is automatically reassociated with ongoing background activity.
    /// When your app later receives a URLSessionDidFinishEventsForBackgroundURLSession: message, this indicates that all messages previously enqueued for this session have been delivered, and that it is now safe to invoke the previously stored completion handler or to begin any internal updates that may result in invoking the completion handler.
    /// - Important:
    ///             Because the provided completion handler is part of UIKit, you must call it on your main thread. For example:
    /// - Listing 1:
    /// ```
    /// [[NSOperationQueue mainQueue] addOperationWithBlock:^{
    ///     storedHandler();
    /// }];
    /// ```
    /// - Parameters:
    ///   - session: The session that no longer has any outstanding requests.
    public func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) {
        
    }
#endif
}

// MARK: URLSessionTaskDelegate

extension SessionDelegate: URLSessionTaskDelegate {
    /// Tells the delegate that the remote server requested an HTTP redirect.
    /// This method is called only for tasks in default and ephemeral sessions. Tasks in background sessions automatically follow redirects.
