Fixed the validation to open a new session if the session is null or is
not connected.
Add test project.