diff options
| author | Steven Fackler <[email protected]> | 2015-06-28 00:06:14 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2015-06-28 00:06:14 -0700 |
| commit | 1373a76ce12d6a856b6caae7457ceb3eb5ad4122 (patch) | |
| tree | 67317b8480482532e79dc31adb466fb78c49e1f6 /openssl/src/ssl/tests.rs | |
| parent | Prepare for direct stream support (diff) | |
| download | rust-openssl-1373a76ce12d6a856b6caae7457ceb3eb5ad4122.tar.xz rust-openssl-1373a76ce12d6a856b6caae7457ceb3eb5ad4122.zip | |
Implement direct IO support
Diffstat (limited to 'openssl/src/ssl/tests.rs')
| -rw-r--r-- | openssl/src/ssl/tests.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/openssl/src/ssl/tests.rs b/openssl/src/ssl/tests.rs index a0e4a9d6..2ba940ab 100644 --- a/openssl/src/ssl/tests.rs +++ b/openssl/src/ssl/tests.rs @@ -317,8 +317,17 @@ fn test_write() { stream.flush().unwrap(); } +#[test] +fn test_write_direct() { + let stream = TcpStream::connect("127.0.0.1:15418").unwrap(); + let mut stream = SslStream::new_client_direct(&SslContext::new(Sslv23).unwrap(), stream).unwrap(); + stream.write_all("hello".as_bytes()).unwrap(); + stream.flush().unwrap(); + stream.write_all(" there".as_bytes()).unwrap(); + stream.flush().unwrap(); +} + run_test!(get_peer_certificate, |method, stream| { - //let stream = TcpStream::connect("127.0.0.1:15418").unwrap(); let stream = SslStream::new_client(&SslContext::new(method).unwrap(), stream).unwrap(); let cert = stream.get_peer_certificate().unwrap(); let fingerprint = cert.fingerprint(SHA256).unwrap(); @@ -349,6 +358,14 @@ fn test_read() { io::copy(&mut stream, &mut io::sink()).ok().expect("read error"); } +#[test] +fn test_read_direct() { + let tcp = TcpStream::connect("127.0.0.1:15418").unwrap(); + let mut stream = SslStream::new_client_direct(&SslContext::new(Sslv23).unwrap(), tcp).unwrap(); + stream.write_all("GET /\r\n\r\n".as_bytes()).unwrap(); + stream.flush().unwrap(); + io::copy(&mut stream, &mut io::sink()).ok().expect("read error"); +} #[test] fn test_pending() { |