Prevent file leaks in ConnectionInfo.

Also made ConnectionInfo configurable and added a simple unit tests.

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
Merge pull request #3 from oleg-nenashev/ConnectionInfo_fix

Prevent file leaks in ConnectionInfo