See http://forums.java.net/jive/thread.jspa?threadID=29654&tstart=0
You can reproduce this issue running on Windows XP or 2003 with IPv6 enabled.
--- begin code ---
public class SockTest
{
public static void main(String[] args) throws Exception {
ServerSocket ss = new ServerSocket(4444);
Runtime.getRuntime().exec(new String[] {"notepad.exe"});
ss.close();
}
}
--- end code ---
The above testcase spawns a notepad. Notepad inherits the handle to the socket, so if you try and re-execute the test if fails with "BindException: Address already in use".
This is reproducible with Java SE 5, 6, and 7.