You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: lifecycle.rs
    path of file: ./repos/ockam/implementations/rust/ockam/ockam_transport_tcp/tests
    
    the code of the file until where you have to start completion: use core::time::Duration;
use ockam_core::compat::rand::{self, Rng};
use ockam_core::{route, Result, Routed, Worker};
use ockam_node::Context;
use ockam_transport_tcp::{TcpConnectionOptions, TcpListenerOptions, TcpTransport};

p
    
async fn tcp_lifecycle__disconnect__should_stop_worker(ctx: &mut Context) -> Result<()> {
    let options = TcpListenerOptions::new();
    ctx.flow_controls()
        .add_consumer("echoer", &options.spawner_flow_control_id());
    ctx.start_worker("echoer", Echoer).await?;

    let transport = TcpTransport::create(ctx).await?;
    let listener = transport.listen("127.0.0.1:0", options).await?;

    let msg1: String = rand::thread_rng()
        .sample_iter(&rand::distributions::Alphanumeric)
        .take(256)
        .map(char::from)
        .collect();
    let msg2: String = rand::thread_rng()
        .sample_iter(&rand::distributions::Alphanumeric)
        .take(256)
        .map(char::from)
        .collect();
    let msg3: String = rand::thread_rng()
        .sample_iter(&rand::distributions::Alphanumeric)
        .take(256)
        .map(char::from)
        .collect();

    let connection1 = transport
        .connect(&listener.socket_string(), TcpConnectionOptions::new())
        .await?;

    let reply1: String = ctx
        .send_and_receive(route![connection1.clone(), "echoer"], msg1.clone())
        .await?;
    assert_eq!(reply1, msg1, "Should receive the same message");

    let connection2 = transport
        .connect(&listener.socket_string(), TcpConnectionOptions::new())
        .await?;
    let reply2: String = ctx
        .send_and_receive(route![connection2.clone(), "echoer"], msg2.clone())
        .await?;
    assert_eq!(reply2, msg2, "Should receive the same message");

    transport.disconnect(connection1.clone()).await?;
    let res = ctx
        .send(route![connection1.clone(), "echoer"], msg1.clone())
        .await;
    assert!(res.is_err(), "Should not send messages after disconnection");

    let reply3: String = ctx
        .send_and_receive(route![connection2.clone(), "echoer"], msg3.clone())
        .await?;
    assert_eq!(reply3, msg3, "Should receive the same message");

    transport.disconnect(connection2.clone()).await?;
    let res = ctx
        .send(route![connection2.clone(), "echoer"], msg3.clone())
        .await;
    assert!(res.is_err(), "Should not send messages after disconnection");
    Ok(())
}