netopt 0.1.3

Provides options to work with tcp or ssl streams and has a choice in between.
extern crate mqtt3;
#[cfg(feature = "ssl")]
extern crate openssl;

#[cfg(feature = "ssl")]
mod ssl;
mod tcp;
pub mod mock;
pub mod conn;

pub use tcp::{
    NetworkOptions,
    NetworkListener,
    NetworkStream,
    NetworkWriter,
    NetworkReader
};

pub use ssl::{
    SslContext,
    SslStream,
    SslError
};

pub use conn::{
    Connection
};

#[cfg(not(feature = "ssl"))]
pub mod ssl {
    use mock::MockStream;
    use std::net::TcpStream;
    use std::io;
    use std::error::Error;

    pub type SslStream = MockStream;
    pub type SslError = Error;

    #[derive(Debug, Clone)]
    pub struct SslContext;

    impl SslContext {
        pub fn accept(&self, _: TcpStream) -> Result<SslStream, io::Error> {
            panic!("ssl disabled");
        }
    }
}