add reconnect support

Signed-off-by: Haohua Li <lihaohua90@gmail.com>