Delete method MessageQueue::set_socketserver

Instead, make the pointer to the associated socket server a
construction time const, and delete its lock.

Introduces a helper class AutoSocketServerThread for code
(mainly tests) which need a socket server associated with
the current thread.

BUG=webrtc:7501

Review-Url: https://codereview.webrtc.org/2828223002
Cr-Commit-Position: refs/heads/master@{#18047}
diff --git a/webrtc/p2p/base/tcpport_unittest.cc b/webrtc/p2p/base/tcpport_unittest.cc
index 5a23202..7b354df 100644
--- a/webrtc/p2p/base/tcpport_unittest.cc
+++ b/webrtc/p2p/base/tcpport_unittest.cc
@@ -31,10 +31,9 @@
 class TCPPortTest : public testing::Test, public sigslot::has_slots<> {
  public:
   TCPPortTest()
-      : main_(rtc::Thread::Current()),
-        pss_(new rtc::PhysicalSocketServer),
+      : pss_(new rtc::PhysicalSocketServer),
         ss_(new rtc::VirtualSocketServer(pss_.get())),
-        ss_scope_(ss_.get()),
+        main_(ss_.get()),
         network_("unittest", "unittest", rtc::IPAddress(INADDR_ANY), 32),
         socket_factory_(rtc::Thread::Current()),
         username_(rtc::CreateRandomString(ICE_UFRAG_LENGTH)),
@@ -59,15 +58,14 @@
   }
 
   TCPPort* CreateTCPPort(const SocketAddress& addr) {
-    return TCPPort::Create(main_, &socket_factory_, &network_, addr.ipaddr(), 0,
-                           0, username_, password_, true);
+    return TCPPort::Create(&main_, &socket_factory_, &network_, addr.ipaddr(),
+                           0, 0, username_, password_, true);
   }
 
  protected:
-  rtc::Thread* main_;
   std::unique_ptr<rtc::PhysicalSocketServer> pss_;
   std::unique_ptr<rtc::VirtualSocketServer> ss_;
-  rtc::SocketServerScope ss_scope_;
+  rtc::AutoSocketServerThread main_;
   rtc::Network network_;
   rtc::BasicPacketSocketFactory socket_factory_;
   std::string username_;