title: Server forcibly closing connection when attempting SSL connection
body: <p>I'm trying to create an ssl connection between server and client, but I keep getting a <code>ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine</code> error.</p>
  
  <p><strong>client.py</strong></p>
  
  <pre><code>class Client(object):
      def __init__(self):
          threading.Thread(target=self.init_sock).start()
      def init_sock(self):
          host = 'localhost'
          port = 49374
          baresock = socket(AF_INET6, SOCK_STREAM)
          context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
          self.servsock = context.wrap_socket(baresock, server_hostname=host)
          try:
              self.servsock.connect((host, port))  #&lt;--- Line error is being thrown at
              logging.info("Connection Successful")
          except:
              logging.info("Connection Problem")
              return
          threading.Thread(target=self.listen_loop).start()
  </code></pre>
  
  <p>And <strong>server.py</strong>:</p>
  
  <pre><code>class ClientHandler(socketserver.BaseRequestHandler):
      def handle(self):
          pass
  
  class Server(socketserver.ThreadingTCPServer):
      srvhost = ''
      srvport = 49374
  
      def __init__(self,
                   request_handler_class=ClientHandler,
                   certfile="../scache/cert.pem",
                   keyfile="../scache/key.pem",
                   ssl_version=ssl.PROTOCOL_TLSv1_2,
                   bind_and_activate=True):
          self.address_family = socket.AF_INET6
          self.certfile = certfile
          self.keyfile = keyfile
          self.ssl_version = ssl_version
          server_address = (self.srvhost, self.srvport)
          super(Server, self).__init__(server_address, request_handler_class, bind_and_activate)
  
      def get_request(self):
          newsocket, fromaddr = self.socket.accept()
          context = ssl.create_default_context()
          context.load_cert_chain(certfile=self.certfile, keyfile=self.keyfile) # &lt;------ Hanging Here
          logging.info("New Request from " + fromaddr[0])
          connstream = context.wrap_socket(newsocket, server_side=True)
          logging.info("Socket Wrapped")
          return connstream, fromaddr
  </code></pre>
  
  <p>When I attempt to connect to the Server from the Client, The client throws the WinError 10054 as noted above.  When I try to use the debugger on the Server side, I can follow the error to <code>socketserver.py</code>'s <code>_handle_request_noblock</code> method where <code>request, client_address = self.get_request()</code> is throwing an OSError.  Full Traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Program Files\Anaconda3\lib\threading.py", line 916, in _bootstrap_inner
      self.run()
    File "C:\Program Files\Anaconda3\lib\threading.py", line 864, in run
      self._target(*self._args, **self._kwargs)
    File "C:/Project/src/client.py", line 36, in init_sock
      self.servsock.connect((host, port))
    File "C:\Program Files\Anaconda3\lib\ssl.py", line 1093, in connect
      self._real_connect(addr, False)
    File "C:\Program Files\Anaconda3\lib\ssl.py", line 1084, in _real_connect
      self.do_handshake()
    File "C:\Program Files\Anaconda3\lib\ssl.py", line 1061, in do_handshake
      self._sslobj.do_handshake()
    File "C:\Program Files\Anaconda3\lib\ssl.py", line 683, in do_handshake
      self._sslobj.do_handshake()
  ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
  </code></pre>
  
  <p>What is causing this error, and how do I troubleshoot it?  Thanks.</p>