Improve fixes in pull #5

* Ensure connection is established and backend set for session (thanks
to @kzeslaf for reporting this)
* Add test_pull5 to ensure no crash occurs (see Krzysztof's example in
pull #5 comments)
* Add test0 testing connection ensured
* Add test31 with basic use of connection_pool (no multiple threads,
sequential use only)