Fixed an issue that caused the tests to fail with the `socket hang up` error

I was receiving the `socket hang up` error during the execution of the tests.
This patch fixed the issue on my machine.