A simple technique on MacOS which I use every now and then when my SSH connections hang due to network disconnect. You can immediately terminate the hung SSH session by pressing ~. (tilde and dot) keys together.
http://apple.stackexchange.com/questions/35524/what-can-i-do-when-my-ssh-session-is-stuck