How Mockingjay intercepts network requests
masterMockingjay works by registering a custom NSURLProtocol called MockingjayProtocol.
When you initiate a network request using NSURLConnection or NSURLSession, the system iterates through all registered protocols and calls canInitWithRequest. MockingjayProtocol intercepts these calls by checking if the request matches any of your registered stubs. If a match is found, it returns true, signaling to the system that Mockingjay should handle the request.
Stub Matching Order:
When multiple stubs match a request, MockingjayProtocol searches through the registered stubs backwards. This means the last registered stub that matches the request will be the one used to handle it.