Added a timeout manager and tests for it.