/** * Like connect() but returns a real Socket, and throws only IOE, for easier porting of apps. * * @param timeout ms if > 0, forces blocking (disables connectDelay) * @since 0.8.4 */ public Socket connectToSocket(Destination peer, int timeout) throws IOException { ConnectionOptions opts = new ConnectionOptions(_defaultOptions); opts.setConnectTimeout(timeout); if (timeout > 0) opts.setConnectDelay(-1); return connectToSocket(peer, opts); }