return error code on connection refusal
Merge pull request #2 from adeel-raza/patch-2

return error code on connection refusal