Add tests for timeout and handle timeouts with correct exceptions.