bpo-40275: Avoid importing socket in test.support (GH-19603)

* Move socket related functions from test.support to socket_helper.
* Import socket, nntplib and urllib.error lazily in transient_internet().
* Remove importing multiprocess.
diff --git a/Lib/test/test_timeout.py b/Lib/test/test_timeout.py
index ff41b13..c0952c7 100644
--- a/Lib/test/test_timeout.py
+++ b/Lib/test/test_timeout.py
@@ -3,6 +3,7 @@
 import functools
 import unittest
 from test import support
+from test.support import socket_helper
 
 # This requires the 'network' resource as given on the regrtest command line.
 skip_expected = not support.is_resource_enabled('network')
@@ -110,7 +111,7 @@
     # solution.
     fuzz = 2.0
 
-    localhost = support.HOST
+    localhost = socket_helper.HOST
 
     def setUp(self):
         raise NotImplementedError()
@@ -240,14 +241,14 @@
 
     def testAcceptTimeout(self):
         # Test accept() timeout
-        support.bind_port(self.sock, self.localhost)
+        socket_helper.bind_port(self.sock, self.localhost)
         self.sock.listen()
         self._sock_operation(1, 1.5, 'accept')
 
     def testSend(self):
         # Test send() timeout
         with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
-            support.bind_port(serv, self.localhost)
+            socket_helper.bind_port(serv, self.localhost)
             serv.listen()
             self.sock.connect(serv.getsockname())
             # Send a lot of data in order to bypass buffering in the TCP stack.
@@ -256,7 +257,7 @@
     def testSendto(self):
         # Test sendto() timeout
         with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
-            support.bind_port(serv, self.localhost)
+            socket_helper.bind_port(serv, self.localhost)
             serv.listen()
             self.sock.connect(serv.getsockname())
             # The address argument is ignored since we already connected.
@@ -266,7 +267,7 @@
     def testSendall(self):
         # Test sendall() timeout
         with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
-            support.bind_port(serv, self.localhost)
+            socket_helper.bind_port(serv, self.localhost)
             serv.listen()
             self.sock.connect(serv.getsockname())
             # Send a lot of data in order to bypass buffering in the TCP stack.
@@ -285,7 +286,7 @@
     def testRecvfromTimeout(self):
         # Test recvfrom() timeout
         # Prevent "Address already in use" socket exceptions
-        support.bind_port(self.sock, self.localhost)
+        socket_helper.bind_port(self.sock, self.localhost)
         self._sock_operation(1, 1.5, 'recvfrom', 1024)