JDK-4956497 : SocketChannel.connect() throws unexpected exception
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.6,windows_98
  • CPU: x86,sparc
  • Submitted: 2003-11-19
  • Updated: 2004-01-14
  • Resolved: 2004-01-13
Related Reports
Duplicate :  
Duplicate :  
Description

Name: auR10023			Date: 11/19/2003


Filed By      : SPB JCK team (###@###.###)
JDK           : java full version "1.5.0-beta-b28"
JCK           : 1.5
Platform[s]   : Win98
switch/Mode   : 
JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
Failing Test [s] :
    api/java_nio/channels/SocketChannel/index.html#Methods[SocketChannel0002]


Problem description
===================
Method java.nio.channels.SocketChannel.connect() throws unexpected exception on windows 98.
    
Minimized test:
===============
------- t.java -------
import java.net.*;
import java.io.*;
import java.nio.channels.*;

public class t {
    public static void main(String[] args) throws IOException {
        ServerSocket soc = new ServerSocket(0);
        int port = soc.getLocalPort();
        ServerSocket serverSocket = new ServerSocket();
        SocketChannel channel = SocketChannel.open();
        channel.configureBlocking(true);
        InetSocketAddress addr = new InetSocketAddress(
            InetAddress.getLocalHost(), port);

        System.out.println(addr);
        serverSocket.bind(addr);
        channel.connect(addr);
    }
}

------- end-of-t.java -------

Minimized test output:
======================
namespace/192.168.205.171:1826
Exception in thread "main" java.net.SocketException: Bad address: connect
        at sun.nio.ch.Net.connect(Native Method)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:464)
        at t.main(t.java:17)


JCK test source location:
==========================
/java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests
    
======================================================================