Test multiple simultaineous active SSL sessions with bi-directional certificate verification, shared across two domains.
(self)
| 460 | |
| 461 | |
| 462 | def test_multiple_sessions(self): |
| 463 | """ Test multiple simultaineous active SSL sessions with bi-directional |
| 464 | certificate verification, shared across two domains. |
| 465 | """ |
| 466 | self.server_domain.set_credentials(self._testpath("server-certificate.pem"), |
| 467 | self._testpath("server-private-key.pem"), |
| 468 | "server-password") |
| 469 | self.server_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem")) |
| 470 | self.server_domain.set_peer_authentication( SSLDomain.VERIFY_PEER, |
| 471 | self._testpath("ca-certificate.pem") ) |
| 472 | |
| 473 | self.client_domain.set_credentials(self._testpath("client-certificate.pem"), |
| 474 | self._testpath("client-private-key.pem"), |
| 475 | "client-password") |
| 476 | self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem")) |
| 477 | self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER ) |
| 478 | |
| 479 | max_count = 100 |
| 480 | sessions = [(SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER ), |
| 481 | SslTest.SslTestConnection( self.client_domain )) for x in |
| 482 | range(max_count)] |
| 483 | for s in sessions: |
| 484 | s[0].connection.open() |
| 485 | self._pump( s[0], s[1] ) |
| 486 | |
| 487 | for s in sessions: |
| 488 | s[1].connection.open() |
| 489 | self._pump( s[1], s[0] ) |
| 490 | assert s[0].ssl.cipher_name() is not None |
| 491 | assert s[1].ssl.cipher_name() == s[0].ssl.cipher_name() |
| 492 | |
| 493 | for s in sessions: |
| 494 | s[1].connection.close() |
| 495 | self._pump( s[0], s[1] ) |
| 496 | |
| 497 | for s in sessions: |
| 498 | s[0].connection.close() |
| 499 | self._pump( s[1], s[0] ) |
| 500 | |
| 501 | def test_singleton(self): |
| 502 | """Verify that only a single instance of SSL can exist per Transport""" |
nothing calls this directly
no test coverage detected