Duplicate :
|
|
Duplicate :
|
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 ======================================================================