title: TLS session resumption in python TLS socket
body: <p>I have a simple TLS client in python that connects to TLS servers. I do not have control over the servers. I need a fresh TLS handshake with each server even if I visited it recently. </p>
  
  <p>1) Do non-browser TLS clients such as the following python client perform session resumption by default? </p>
  
  <p>2) How can I know if they do or do not? How can I disable session resumption if it is performed in the background?</p>
  
  <p>Please note that I create a new socket for each new domain that I connect to.</p>
  
  <pre><code>import socket, ssl
  
  context = ssl.SSLContext() 
  context.verify_mode = ssl.CERT_NONE 
  context.check_hostname = False 
  
  mycipher = "DHE-RSA-AES128-SHA"
  context.set_ciphers(mycipher) 
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
  domain = "google.com"
  mySocket = context.wrap_socket(sock, server_hostname = domain) 
  mySocket.connect((domain, 443))
  mySocket.close()
  </code></pre>