Use errno for testing error type

Original test code is failed on non-English platform.

If user uses Japanese locale, he gets '接続を拒否されました'.
This message is not matched against '/conn/'.

I checked tests applied this patch are passed on Ubuntu 13.10(64bit), Ubuntu 12.04(32bit),
FreeBSD 9.2(64bit), MacOSX 10.9. 

Please check this patch.