If emit error when max connections reties has been reached

I fixed the issue #5 which I saw after I realised of it.
I provided test for it as well.