michaelsims
08/01/2016, 10:05 PMvar 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")
}