fixed the bug that block the connection when remote server close the connection unexpectedly