summaryrefslogtreecommitdiffstats
path: root/third_party/tlslite/test/twistedclient.py
blob: 4f6c86af363bf5f475c102b5cef23c0be3f995c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

from tlslite.api import *
import socket

s = socket.socket()

s.connect( ("localhost", 1079) )

"""
#Only use this for Echo2
s.send("000\r\n")
while 1:
    val= s.recv(100)
    print val,
    if val.endswith("000\r\n"):
        break

s.send("STARTTLS\r\n")
"""

connection = TLSConnection(s)
#connection.handshakeClientNoAuth()
connection.handshakeClientSRP("test", "password")

connection.send("abc\r\n")
print connection.recv(100),
print connection.recv(100),

connection.send("def\r\n")
print connection.recv(100),

connection.close()
connection.sock.close()