Allow the timeout value to be changed.

  We now use a global timeout, defaulting to five seconds, but
 this can be changed.