Issue #4397.  Fix occasional test_socket failure on OS X.
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 1287dd1..eaf9bcb 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -584,6 +584,10 @@
         # Testing shutdown()
         msg = self.cli_conn.recv(1024)
         self.assertEqual(msg, MSG)
+        # wait for _testShutdown to finish: on OS X, when the server
+        # closes the connection the client also becomes disconnected,
+        # and the client's shutdown call will fail. (Issue #4937.)
+        self.done.wait()
 
     def _testShutdown(self):
         self.serv_conn.send(MSG)