title: connect() method ignoring its timeout value
body: <p>I'm developing an application for Android that requires sending messages over a TCP socket connection. I have set a timeout value as per the <code>connect(SocketAddress endpoint, int timeout)</code> method. Now the <code>connect()</code> method blocks till the timeout expires and a <code>SocketException</code> is thrown only if the server is offline. In all other cases like network disabled, network unreachable, etc the timeout value is being ignored and the method directly throws a <code>SocketException (ENETUNREACH)</code>. How do I make sure the timeout works even in such cases? Will supply additional information if required.</p>
  
  <p>Thanks</p>