Windows pipe updates

pull/146/head
Chip Senkbeil 2 years ago
parent 78a5383dc3
commit 4a71a204d0
No known key found for this signature in database
GPG Key ID: 35EF1F8EC72A4131

@ -97,7 +97,7 @@ mod tests {
.await
.expect("Failed to start TCP server");
let mut client: Client<String, String> = Client::<String, String>::tcp()
let mut client: Client<String, String> = Client::tcp()
.auth_handler(TestAuthHandler)
.connect(SocketAddr::from((server.ip_addr(), server.port())))
.await

@ -103,7 +103,7 @@ mod tests {
.await
.expect("Failed to start Unix socket server");
let mut client: Client<String, String> = Client::<String, String>::unix_socket()
let mut client: Client<String, String> = Client::unix_socket()
.auth_handler(TestAuthHandler)
.connect(server.path())
.await

@ -58,9 +58,10 @@ where
mod tests {
use super::*;
use crate::{
auth::Authenticator, Client, ConnectionCtx, PlainCodec, Request, ServerCtx,
WindowsPipeClientExt,
auth::{AuthHandler, AuthQuestion, AuthVerifyKind, Authenticator},
Client, Client, ConnectionCtx, ConnectionCtx, Request, Request, ServerCtx, ServerCtx,
};
use std::collections::HashMap;
pub struct TestServer;
@ -86,6 +87,23 @@ mod tests {
}
}
pub struct TestAuthHandler;
#[async_trait]
impl AuthHandler for TestAuthHandler {
async fn on_challenge(
&mut self,
_: Vec<AuthQuestion>,
_: HashMap<String, String>,
) -> io::Result<Vec<String>> {
Ok(Vec::new())
}
async fn on_verify(&mut self, _: AuthVerifyKind, _: String) -> io::Result<bool> {
Ok(true)
}
}
#[tokio::test]
async fn should_invoke_handler_upon_receiving_a_request() {
let server = WindowsPipeServerExt::start_local(
@ -96,6 +114,7 @@ mod tests {
.expect("Failed to start Windows pipe server");
let mut client: Client<String, String> = Client::windows_pipe()
.auth_handler(TestAuthHandler)
.connect(server.addr())
.await
.expect("Client failed to connect");

Loading…
Cancel
Save