Fix unittest memory leaks
Add support to custom connection providers