Add timeout handling

- Check session timeout when getting a session
- Test session timeout