I tried with tls and I started with a wrong certificate and so it was supposed to return error instead it was panicking.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failure(MidHandshakeSslStream { stream: SslStream { stream: TcpStream { addr: V4(xxx:64067), peer: V4(xxxx:9042), fd: 3 }, ssl: Ssl { state: "error", verify_result: X509VerifyError { code: 19, error: "self signed certificate in certificate chain" } } }, error: Ssl(ErrorStack([Error { code: 336134278, library: "SSL routines", function: "ssl3_get_server_certificate", reason: "certificate verify failed" }])) })', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libcore/result.rs:837
stack backtrace:
1: 0x10f8e0dda - std::sys::imp::backtrace::tracing::imp::write::hd8952e96bd20f4b7
2: 0x10f8e255f - std::panicking::default_hook::{{closure}}::hfd6ba86ea4dd6ba9
3: 0x10f8e2207 - std::panicking::default_hook::h44ade8c78c995294
4: 0x10f8e2a26 - std::panicking::rust_panic_with_hook::h3e771863e3ed8403
5: 0x10f8e2874 - std::panicking::begin_panic::h0af46715c5e7593e
6: 0x10f8e27e2 - std::panicking::begin_panic_fmt::h9509a584fa230ae8
7: 0x10f8e2747 - rust_begin_unwind
8: 0x10f9051f0 - core::panicking::panic_fmt::h5c28b8150c75bd71
9: 0x10f879ee0 - core::result::unwrap_failed::h3e2777ab86f331c6
10: 0x10f86e86c - <core::result::Result<T, E>>::unwrap::h8624c0fc54826597
11: 0x10f8a645e - cdrs::transport_ssl::Transport::new::{{closure}}::h2f0231b2a03a7ed4
12: 0x10f86df87 - <core::result::Result<T, E>>::map::ha45322ee1b6c6507
13: 0x10f8a630d - cdrs::transport_ssl::Transport::new::h517c6ceb7fe0f49d
14: 0x10f8598aa - cdrs_dart::main::h7080965054f13a02
15: 0x10f8e389a - __rust_maybe_catch_panic
16: 0x10f8e2dc6 - std::rt::lang_start::hefd96b70277e8a4a
17: 0x10f85a5c9 - main