Use real variables for tests

Now it's a better and more flexible way to configure test stuff. 
Bonus stuff:
- Also refactored one test to start avoiding code duplication. Should refactor the other tests.
- Added fixme for closed connections

PS: Tests crash but it might be freeling that is causing it.