Dear,
The listenerThread doesn't always exit when close is called causing __thread.join() to hang infinite.
I have a situation where an an exception occurs in send on self.__socket.sendall(data) (e.g. Broken pipe on a closed connection) and close is called afterwards to clean up the connection. Here close hangs forever on the join call for the listenerThread.