qssh 0.0.2-alpha

Experimental quantum-safe SSH using post-quantum crypto. Research project - NOT for production. See LIMITATIONS.md
Documentation
//! Test basic TCP connection without handshake

use tokio::net::TcpStream;
use tokio::io::{AsyncWriteExt, AsyncReadExt};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    println!("Testing TCP connection to localhost:22223...");
    
    match TcpStream::connect("localhost:22223").await {
        Ok(mut stream) => {
            println!("TCP connection successful!");
            
            // Send a simple test message
            let test_data = b"QSSH-TEST\n";
            stream.write_all(test_data).await?;
            stream.flush().await?;
            println!("Sent test data: {:?}", std::str::from_utf8(test_data)?);
            
            // Try to read response
            let mut buffer = [0u8; 1024];
            match tokio::time::timeout(
                std::time::Duration::from_secs(2),
                stream.read(&mut buffer)
            ).await {
                Ok(Ok(n)) => {
                    println!("Received {} bytes", n);
                    if n > 0 {
                        println!("Data: {:?}", &buffer[..n]);
                    }
                }
                Ok(Err(e)) => println!("Read error: {}", e),
                Err(_) => println!("Read timeout (2 seconds)"),
            }
            
            // Close connection
            stream.shutdown().await?;
            println!("Connection closed cleanly");
        }
        Err(e) => {
            eprintln!("TCP connection failed: {}", e);
            std::process::exit(1);
        }
    }
    
    Ok(())
}