properly fix the port==0 issue and use it in more tests

- add documentation to RemoteTransport interface what is expected wrt.
  address’ availability before, during and after start()
This commit is contained in:
Roland 2012-01-27 15:21:05 +01:00
parent ac1ee9ae91
commit 4482f14650
6 changed files with 55 additions and 24 deletions

View file

@ -38,14 +38,7 @@ class NettySettings(config: Config, val systemName: String) {
case "" InetAddress.getLocalHost.getHostAddress
case value value
}
val Port = getInt("port") match {
case 0
try {
val s = new java.net.ServerSocket(0)
try s.getLocalPort finally s.close()
} catch { case e throw new ConfigurationException("Unable to obtain random port", e) }
case other other
}
val Port = getInt("port")
val ConnectionTimeout = Duration(getMilliseconds("connection-timeout"), MILLISECONDS)