Backport bpo-30205 to 3.6 (#1403)

diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 2497e47..80dfc40 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -4660,6 +4660,10 @@
             else:
                 raise
 
+    def testUnbound(self):
+        # Issue #30205
+        self.assertIn(self.sock.getsockname(), ('', None))
+
     def testStrAddr(self):
         # Test binding to and retrieving a normal string pathname.
         path = os.path.abspath(support.TESTFN)