It's likely this does actually work, but the problem is the fact your node (Test111) exits too soon for rospy.init_node(..) to successfully complete the initialisation. It is shutdown before it's complete, leading to some resources to already have been deleted (such as that socket), which leads to errors such as the one you show.