private void btnConnect_Click(object sender, EventArgs e) { context = new SslContext(SslProtocols.Tls12, new X509Certificate2("client.pfx", "qwerty"), (senderr, certificate, chain, sslPolicyErrors) => true); client = new ChatClient(context, address, port); // Connect the client label1.Text = "Client connecting..."; client.ConnectAsync(); label1.Text = "Done!"; }