@galex You can also consider using something like OkHttp library for your URL it is blocking inside, but it encapsulates all the thread-management under the hood in a nice async API that is easy to use with coroutines. See
https://github.com/gildor/kotlin-coroutines-okhttp by
@gildor for example