Cleanup createNewTestSession()

Cleans up retry handling and splits out the steps of setting up a session into smaller methods to make this huge function easier to comprehend.