RFR 8006560: java/net/ipv6tests/B6521014.java fails intermittently
Brad Wetmore
bradford.wetmore at oracle.com
Fri Jan 18 10:52:58 PST 2013
Looks good to me. Don't know how many of those we've cleaned over the
years! ;)
Brad
On 1/18/2013 6:23 AM, Chris Hegarty wrote:
> This test can be seen to fail intermittently on a very busy system. The
> test tries to bind to a "hardcoded" (relative to another) port number. I
> see no reason for specify the port number in this testcase. The socket
> needs to be bound to a specific address, but we should be able to
> specify a port of 0 (ephemeral port).
>
> Exception:
> Caused by: java.net.BindException: Address already in use
> at java.net.PlainSocketImpl.socketBind(Native Method)
> at
> java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:382)
> at java.net.Socket.bind(Socket.java:626)
> at B6521014.test2(B6521014.java:105)
> at B6521014.main(B6521014.java:123)
>
> >: hg diff java/net/ipv6tests/B6521014.java
> diff -r a546d8897e0d test/java/net/ipv6tests/B6521014.java
> --- a/test/java/net/ipv6tests/B6521014.java Wed Jan 16 12:09:35 2013
> +0000
> +++ b/test/java/net/ipv6tests/B6521014.java Fri Jan 18 14:18:44 2013
> +0000
> @@ -95,14 +95,12 @@ public class B6521014 {
> Socket sock;
> ServerSocket ssock;
> int port;
> - int localport;
>
> ssock = new ServerSocket(0);
> ssock.setSoTimeout(100);
> port = ssock.getLocalPort();
> - localport = port + 1;
> sock = new Socket();
> - sock.bind(new InetSocketAddress(sin, localport));
> + sock.bind(new InetSocketAddress(sin, 0));
> try {
> sock.connect(new InetSocketAddress(sin, port), 100);
> } catch (SocketTimeoutException e) {
>
> -Chris.
More information about the net-dev
mailing list