Move method used only in the test to the test code itself

This pull request moves a hacky helper method in ConnectionPool class to the test file where it is used in tests.