tcpsocket: add close() method.
sessionmanager: add socket recovery when lost connection.