LPS-47273 Changed retry logic from start to stop. The idea is to make sure that when close method returns, the socket is actually closed.
LPS-47273 Add method guards. Don't throw exceptions if everything is already ok