fix socket handling and add two tests threaded and not