Properly exit with a MonAmiReset() if the connection breaks prematurely.
Add keepalive support.