You immediately close the socket without giving the eventloop time to process the connections (which will havppen in a.exec()).
Move the socket close to the destructor.