Skip to content

Commit

Permalink
Add test case that uses Heartbeat extension and callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
mildas committed Jun 20, 2018
1 parent b04d355 commit 97e5be2
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/tlstest.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,21 @@ def connect():

test_no += 1

print("Test {0} - Heartbeat extension response callback".format(test_no))
synchro.recv(1)
connection = connect()
settings = HandshakeSettings()
heartbeatPayload = os.urandom(100)
def heartbeatResponseCheck(message):
assert heartbeatPayload == message.payload
settings.heartbeat_response_callback = heartbeatResponseCheck
connection.handshakeClientCert(serverName=address[0], settings=settings)
connection.sendHeartbeatRequest(heartbeatPayload, 16)
testConnClient(connection)
connection.close()

test_no += 1

print('Test {0} - good standard XMLRPC https client'.format(test_no))
address = address[0], address[1]+1
synchro.recv(1)
Expand Down Expand Up @@ -1638,6 +1653,22 @@ def server_bind(self):

test_no += 1

print("Test {0} - Heartbeat extension response callback".format(test_no))
synchro.send(b'R')
connection = connect()
settings = HandshakeSettings()
heartbeatPayload = os.urandom(100)
def heartbeatResponseCheck(message):
assert heartbeatPayload == message.payload
settings.heartbeat_response_callback = heartbeatResponseCheck
connection.handshakeServer(certChain=x509Chain, privateKey=x509Key,
settings=settings)
connection.sendHeartbeatRequest(heartbeatPayload, 16)
testConnServer(connection)
connection.close()

test_no += 1

print("Tests {0}-{1} - XMLRPXC server".format(test_no, test_no + 2))
test_no += 2

Expand Down

0 comments on commit 97e5be2

Please sign in to comment.