MCPcopy Create free account
hub / github.com/apache/qpid-proton / test_session_resume

Method test_session_resume

python/tests/proton_tests/ssl.py:567–638  ·  view source on GitHub ↗

Test resume of client session.

(self)

Source from the content-addressed store, hash-verified

565 assert server.connection.state & Endpoint.REMOTE_UNINIT
566
567 def test_session_resume(self):
568 """ Test resume of client session.
569 """
570 if os.name == "nt":
571 raise Skipped("Windows SChannel session resume not yet implemented.")
572
573 self.server_domain.set_credentials(self._testpath("server-certificate.pem"),
574 self._testpath("server-private-key.pem"),
575 "server-password")
576 self.server_domain.set_peer_authentication(SSLDomain.ANONYMOUS_PEER)
577
578 self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
579 self.client_domain.set_peer_authentication(SSLDomain.VERIFY_PEER)
580
581 # details will be used in initial and subsequent connections to allow session to be resumed
582 initial_session_details = SSLSessionDetails("my-session-id")
583
584 server = SslTest.SslTestConnection(self.server_domain, mode=Transport.SERVER)
585 client = SslTest.SslTestConnection(self.client_domain, session_details=initial_session_details)
586
587 # bring up the connection and store its state
588 client.connection.open()
589 server.connection.open()
590 self._pump(client, server)
591 assert client.ssl.protocol_name() is not None
592
593 # cleanly shutdown the connection
594 client.connection.close()
595 server.connection.close()
596 self._pump(client, server)
597
598 # destroy the existing clients
599 del client
600 del server
601
602 # now create a new set of connections, use last session id
603 server = SslTest.SslTestConnection(self.server_domain, mode=Transport.SERVER)
604 # provide the details of the last session, allowing it to be resumed
605 client = SslTest.SslTestConnection(self.client_domain, session_details=initial_session_details)
606
607 # client.transport.trace(Transport.TRACE_DRV)
608 # server.transport.trace(Transport.TRACE_DRV)
609
610 client.connection.open()
611 server.connection.open()
612 self._pump(client, server)
613 assert server.ssl.protocol_name() is not None
614 assert client.ssl.resume_status() == SSL.RESUME_REUSED
615
616 client.connection.close()
617 server.connection.close()
618 self._pump(client, server)
619
620 # now try to resume using an unknown session-id, expect resume to fail
621 # and a new session is negotiated
622
623 del client
624 del server

Callers

nothing calls this directly

Calls 10

_pumpMethod · 0.95
SSLSessionDetailsClass · 0.90
SkippedClass · 0.85
set_credentialsMethod · 0.45
set_trusted_ca_dbMethod · 0.45
openMethod · 0.45
protocol_nameMethod · 0.45
closeMethod · 0.45
resume_statusMethod · 0.45

Tested by

no test coverage detected