TIMOB-14874-Make sure that listening thread check for socket to be valid