>When the data is available then OnDataAvailable() callback will be called and we will read the data from the channel and main thread continue to process as per the data available.
Callbacks don't work like that.
All Gecko threads run an event loop. In the case of the UI thread this
thread processes native UI events. Other threads only process Gecko
events, known as runnables.
Once you call AsyncOpen you need to return to your calling event loop.
At some point a runnable will be posted to the loop which will trigger
the OnDataAvailable call.