1 2 from tlslite.api import * 3 import socket 4 5 s = socket.socket() 6 7 s.connect( ("localhost", 1079) ) 8 9 """ 10 #Only use this for Echo2 11 s.send("000\r\n") 12 while 1: 13 val= s.recv(100) 14 print val, 15 if val.endswith("000\r\n"): 16 break 17 18 s.send("STARTTLS\r\n") 19 """ 20 21 connection = TLSConnection(s) 22 #connection.handshakeClientNoAuth() 23 connection.handshakeClientSRP("test", "password") 24 25 connection.send("abc\r\n") 26 print connection.recv(100), 27 print connection.recv(100), 28 29 connection.send("def\r\n") 30 print connection.recv(100), 31 32 connection.close() 33 connection.sock.close()