AFNetworking/AFNetworking — pull request #1009 by blakewatters (2013-05-18 18:55:46+00:00)
Title: Fix for "Stream is sending an event before being opened"

Fix for AFNetworking/AFNetworking#948

Note that I was not able to reliably recreate this issue in a pure unit testing environment. It seems like the added activity and threading going on in a real app makes this issue more apparent. I was able to reliably recreate this in an app reliably to validate the fix. This fix is also more or less a direct port of a similar fix applied by the CouchDB folks in TouchDB (see couchbaselabs/TouchDB-iOS#99).

Also includes support for optionally logging request/response output during test execution via the `AFTestsLoggingEnabled` environment variable.