From 709ba4e7b0580b32208384c6cedc9d2bd13da828 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 9 Oct 2013 21:01:38 -0700 Subject: Semi-fix EOF --- src/ssl/test.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/ssl/test.rs') diff --git a/src/ssl/test.rs b/src/ssl/test.rs index 36969e1b..3432e2a7 100644 --- a/src/ssl/test.rs +++ b/src/ssl/test.rs @@ -1,8 +1,10 @@ extern mod ssl; use std::rt::io::{Writer, Reader}; +use std::rt::io::extensions::{ReaderUtil}; use std::rt::io::net::tcp::TcpStream; use std::vec; +use std::str; use ssl::{Sslv23, SslCtx, SslStream}; @@ -27,3 +29,13 @@ fn test_write() { stream.flush(); stream.shutdown(); } + +#[test] +fn test_read() { + let stream = TcpStream::connect(FromStr::from_str("127.0.0.1:15418").unwrap()).unwrap(); + let mut stream = SslStream::new(SslCtx::new(Sslv23), stream); + stream.write("GET /\r\n\r\n".as_bytes()); + stream.flush(); + let buf = stream.read_to_end(); + print!("{}", str::from_utf8(buf)); +} -- cgit v1.2.3