fix exeptionhandling and cancel key from selector on client disconnect
reformat main
readd args to main