Make connection threads daemon-mode, so they die with the main program
Start catching Exception to avoid catching SystemExit etc.