Reconnect code for nettty