create a java.net.Socket object instead of SocketAdaptor
@@ -2554,10 +2554,12 @@ final class SocketFinder {
// if a channel was selected, make the necessary updates
if (selectedChannel != null) {
- // Note that this must be done after selector is closed. Otherwise,
- // we would get an illegalBlockingMode exception at run time.
- selectedChannel.configureBlocking(true);
- selectedSocket = selectedChannel.socket();
+ //the selectedChannel has the address that is connected successfully
+ //create a java.net.Socket object with the address
+ SocketAddress iadd = selectedChannel.getRemoteAddress();
+ selectedSocket = new Socket();
+ selectedSocket.connect(iadd, timeoutInMilliSeconds);
+
result = Result.SUCCESS;
}
}
