use

inline fun <R> URL.use(block: (URLConnection) -> R): R