chore: test client call server

This commit is contained in:
Del Wang
2026-01-02 17:37:27 +08:00
parent a2d06958e1
commit c4f7fbec6d
3 changed files with 66 additions and 7 deletions
+17 -1
View File
@@ -4,6 +4,22 @@ use std::sync::Arc;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = Arc::new(Client::new());
client.run().await?;
let c = client.clone();
tokio::spawn(async move {
if let Err(e) = c.run().await {
eprintln!("Client error: {}", e);
}
});
// Wait for connection
tokio::time::sleep(std::time::Duration::from_secs(3)).await;
println!("Testing RPC call to server...");
match client.call("hello", vec!["world".to_string()]).await {
Ok(res) => println!("Server RPC response: {}", res.stdout),
Err(e) => eprintln!("Server RPC call failed: {}", e),
}
tokio::signal::ctrl_c().await?;
Ok(())
}