for bug #88, add timeout for connect.