title: Specify connection timeout in java.nio
body: <p>Using non-blocking I/O, the code for connecting to a remote address looks something like:</p>
  
  <pre><code>SocketChannel channel = SelectorProvider.provider().openSocketChannel();
  channel.configureBlocking(false);
  channel.connect(address);
  </code></pre>
  
  <p>The connection process will then have to be finished by invoking <code>finishConnect()</code> on the channel when some selector says the corresponding key <code>isConnectable()</code>.</p>
  
  <p>Is there a way to specify the connection timeout when using this idiom?</p>