This Question asked in Most Android Exams, but I didn't got any answer from any android forums.
Thanks in advance.
Never ever ever ever ever ever ever ever ever ever ever.
Ever.
It's quite literally impossible to do so on Android.
Android itself will throw an exception if you try to do it on the UI thread.
https://developer.android.com/reference/android/os/NetworkOnMainThreadException.html