public static void connect(Socket socket, 
      SocketAddress endpoint, 
      int timeout) throws IOException {
    connect(socket, endpoint, timeout, NOT_SET_IP_TOS);
  }
public static void connect ( Socket socket , SocketAddress endpoint , int timeout ) throws IOException { connect ( socket , endpoint , timeout , NOT_SET_IP_TOS ) ; }
This is a drop-in replacement for
{@link Socket#connect(SocketAddress, int)}.
In the case of normal sockets that don't have associated channels, this
just invokes <code>socket.connect(endpoint, timeout)</code>. If
<code>socket.getChannel()</code> returns a non-null channel,
connect is implemented using Hadoop's selectors. This is done mainly
to avoid Sun's connect implementation from creating thread-local
selectors, since Hadoop does not have control on when these are closed
and could end up taking all the available file descriptors.

@see java.net.Socket#connect(java.net.SocketAddress, int)

@param socket
@param endpoint
@param timeout - timeout in milliseconds