public void connect(SocketAddress endpoint, int timeout) throws IOException
public void connect(SocketAddress endpoint) throws IOException
	public void connect(SocketAddress endpoint, int timeout)    throws IOException  {    if (isClosed())      throw new SocketException("socket is closed");    if (! (endpoint instanceof InetSocketAddress))      throw new IllegalArgumentException("unsupported address type");    // The Sun spec says that if we have an associated channel and    // it is in non-blocking mode, we throw an IllegalBlockingModeException.    // However, in our implementation if the channel itself initiated this    // operation, then we must honor it regardless of its blocking mode.    if (getChannel() != null && ! getChannel().isBlocking()        && ! ((PlainSocketImpl) getImpl()).isInChannelOperation())			throw new IllegalBlockingModeException();    if (! isBound())      bind(null);    try      {	getImpl().connect(endpoint, timeout);      }    catch (IOException exception)      {	close();	throw exception;      }    catch (RuntimeException exception)      {	close();	throw exception;      }    catch (Error error)      {	close();	throw error;      }	}