tests: Ensure server connection is NULL before creating it
For test cases where server connection is created twice, unref it after first usage. And do not unref database before using it second time.
Edited by Fredrik Ternerot
For test cases where server connection is created twice, unref it after first usage. And do not unref database before using it second time.