Mosh is a mobile shell that maintains your current state no matter what happens to the connection. For example, you can leave a tab in your terminal program open to a server you want to access regularly and just open and close your laptop or device willy nilly. It works for OS X and Android and really seems stable. It’s essentially a persistent SSH connection that ensures you don’t lose your work.
You can grab it here to try it out. You’ll be pleased.