7123896: Unexpected behavior due to Solaris using separate IPv4 and IPv6 port spaces

Reviewed-by: alanb
This commit is contained in:
Sean Coffey 2012-05-17 12:21:16 +01:00
parent 9c3e5a2081
commit 6e3d96dc67
6 changed files with 54 additions and 13 deletions

View file

@ -26,6 +26,8 @@
* @bug 4476378
* @summary Check the specific behaviour of the setReuseAddress(boolean)
* method.
* @run main Basic
* @run main/othervm -Dsun.net.useExclusiveBind Basic
*/
import java.net.*;
@ -170,7 +172,12 @@ public class Basic {
s2.bind( new InetSocketAddress(s1.getLocalPort()) );
passed();
} catch (BindException e) {
failed();
if (System.getProperty("sun.net.useExclusiveBind") != null) {
// exclusive bind enabled - expected result
passed();
} else {
failed();
}
}
s2.close();

View file

@ -26,6 +26,8 @@
* @bug 4476378
* @summary Check that SO_REUSEADDR allows a server to restart
* after a crash.
* @run main Restart
* @run main/othervm -Dsun.net.useExclusiveBind Restart
*/
import java.net.*;
@ -57,6 +59,12 @@ public class Restart {
// close the client socket
s1.close();
} catch (BindException be) {
if (System.getProperty("sun.net.useExclusiveBind") != null) {
// exclusive bind, expected exception
} else {
throw be;
}
} finally {
if (ss != null) ss.close();
if (s1 != null) s1.close();