correcting compile issues
added test and correcting gotError code to ensure it releases these connections even if an InterruptedException occurs