Files
crank/crates/crank-adapter-grpc/examples/stream_fixture.rs
T
2026-04-06 12:12:21 +03:00

23 lines
712 B
Rust

use crank_adapter_grpc::test_support::{EchoServiceImpl, echo};
use tokio::net::TcpListener;
use tonic::transport::Server;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let bind = std::env::var("CRANK_E2E_GRPC_FIXTURE_BIND")
.unwrap_or_else(|_| "127.0.0.1:3311".to_owned());
let listener = TcpListener::bind(&bind).await?;
let incoming = tonic::transport::server::TcpIncoming::from(listener);
println!("gRPC stream fixture listening on http://{bind}");
Server::builder()
.add_service(echo::echo_service_server::EchoServiceServer::new(
EchoServiceImpl,
))
.serve_with_incoming(incoming)
.await?;
Ok(())
}