Client session refactoring. IDisposable. Middleware tests. Integration tests.