https_server: Fix example test failure
Closed the client connection gracefully for the https server
callback check to pass in test
Made some functions static in the example
@@ -141,11 +141,13 @@ def test_examples_protocol_https_server_simple(env, extra_data): # type: (tiny_
resp = conn.getresponse()
dut1.expect('performing session handshake')
got_resp = resp.read().decode('utf-8')
- # Close the connection
if got_resp != success_response:
Utility.console_log('Response obtained does not match with correct response')
raise RuntimeError('Failed to test SSL connection')
+ # Close the connection
+ conn.close()
+
Utility.console_log('Checking user callback: Obtaining client certificate...')
serial_number = dut1.expect(re.compile(r'serial number(.*)'), timeout=5)[0]
@@ -158,7 +160,6 @@ def test_examples_protocol_https_server_simple(env, extra_data): # type: (tiny_
Utility.console_log('Correct response obtained')
Utility.console_log('SSL connection test successful\nClosing the connection')
- conn.close()
if __name__ == '__main__':
