I've investigated this issue a bit.
Most test cases use tests.support.Support_PortManager.getNextPort() method to generate the "random" port numbers from 6000 to 65535. However, some ports are occupied by other applications, and when getNextPort() provides some test case with an occupied port number, that test case fails.
Possible ways to resolve the problem are:
1. "Check" each port number for availability at the start of each test case.
1.1. For example, by creating ServerSocket with some "well known" parameters and making sure no exception occurs.
1.2. Another way may be creating a Socket to that port and making sure the connection fails.
2. Change the port numbers range to exclude the occupied ports. Not a good solution, of course.
3. Use fixed port numbers instead of "random" ones. This is more reliable, but also not very good, and also limits the "coverage".
4. Do not treat a BindException as a test fail, and try another port instead, may be 3 times or so.
I'm not a java.net developer, so I'm not sure which way is good and which is not, so suggestions would be appreciated.