Test TLS with client only
(self, tctx: context.Context)
| 535 | |
| 536 | class TestClientTLS: |
| 537 | def test_client_only(self, tctx: context.Context): |
| 538 | """Test TLS with client only""" |
| 539 | playbook, client_layer, tssl_client = make_client_tls_layer(tctx) |
| 540 | client_layer.debug = " " |
| 541 | assert not tctx.client.tls_established |
| 542 | |
| 543 | # Send ClientHello, receive ServerHello |
| 544 | data = tutils.Placeholder(bytes) |
| 545 | assert ( |
| 546 | playbook |
| 547 | >> events.DataReceived(tctx.client, tssl_client.bio_read()) |
| 548 | << tls.TlsClienthelloHook(tutils.Placeholder()) |
| 549 | >> tutils.reply() |
| 550 | << tls.TlsStartClientHook(tutils.Placeholder()) |
| 551 | >> reply_tls_start_client() |
| 552 | << commands.SendData(tctx.client, data) |
| 553 | ) |
| 554 | tssl_client.bio_write(data()) |
| 555 | tssl_client.do_handshake() |
| 556 | # Finish Handshake |
| 557 | finish_handshake(playbook, tctx.client, tssl_client) |
| 558 | |
| 559 | assert tssl_client.obj.getpeercert(True) |
| 560 | assert tctx.client.tls_established |
| 561 | |
| 562 | # Echo |
| 563 | _test_echo(playbook, tssl_client, tctx.client) |
| 564 | other_server = Server(address=None) |
| 565 | assert ( |
| 566 | playbook |
| 567 | >> events.DataReceived(other_server, b"Plaintext") |
| 568 | << commands.SendData(other_server, b"plaintext") |
| 569 | ) |
| 570 | |
| 571 | @pytest.mark.parametrize("server_state", ["open", "closed"]) |
| 572 | def test_server_required(self, tctx, server_state): |
nothing calls this directly
no test coverage detected