``` var server: HttpProxyServer? = null for (candi...
# codereview
m
Copy code
var server: HttpProxyServer? = null
for (candidatePort in 8090..9000 step 10) {
    try {
        server = DefaultHttpProxyServer.bootstrap().withPort(candidatePort).start()
        break
    } catch(e: BindException) {
    }
}
if (server == null) {
    throw IllegalStateException("Couldn't find suitable port for proxy server")
}