Nathan Beyer wrote:
> For the slow (and lazy), can you point me to one of the tests that
> just uses port 0.
Here's a really simple one from [1] :
/**
* @tests java.net.ServerSocket#toString()
*/
public void test_toString() throws Exception {
s = new ServerSocket(0);
try {
int portNumber = s.getLocalPort();
assertEquals("ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport="
+ portNumber + "]", s.toString());
} finally {
s.close();
}
}
[1]
http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java?revision=515492&view=markup
Regards,
Tim