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: remote_pty.rs
    path of file: ./repos/tunshell/tunshell-client/src/shell/server
    
    the code of the file until where you have to start completion: use crate::shell::proto::{
    RemotePtyDataPayload, RemotePtyEventPayload, ShellClientMessage, ShellServerMessage, WindowSize,
};

use super::shell::Shell;
use super::ShellStream;
use anyhow::{Context, Error, Result};
use async_trait::async_trait;
use futures::StreamExt;
use log::*;
use std::collections::HashMap;
use std::env;
use std::net::ToSocketAddrs;
use std::os::unix::prelude::PermissionsExt;
use std::pin::Pin;
use std::process::{ExitStatus, Stdio};
use std::sync::Arc;
use tokio::io::{AsyncReadExt, WriteHalf};
use tokio::net:
    
    pub(super) async fn new(term: &str, color: bool) -> Result<Self> {
        info!("creating remote pty shell");

        let path = download_rpty_bash().await?;
        let (sock_path, sock_listener) = create_pty_sock().await?;

        let proc = Command::new(path)
            .env("RPTY_TRANSPORT", format!("unix:{sock_path}"))
            .env("TERM", term)
            .env("PS1", if color { 
                r"\[\e[0;38;5;242m\][rpty] \[\e[0;92m\]\u\[\e[0;92m\]@\[\e[0;92m\]\H\[\e[0m\]:\[\e[0;38;5;39m\]\w\[\e[0m\]\$ \[\e[0m\]" 
            } else {
                r"[rpty] \u@\H:\w\$ "
            })
            .arg("--noprofile")
            .arg("--norc")
            .stdin(Stdio::null())
            .stdout(Stdio::null())
            .stderr(Stdio::null())
            .spawn()
            .with_context(|| "Failed to start shell")?;

        let (read_tx, read_rx) = unbounded_channel();

        info!("created remote pty shell");
        Ok(Self {
            connections: HashMap::new(),
            con_id: 0,
            read_tx,
            state: Some(StreamingState {
                proc,
                sock_listener,
                read_rx,
            }),
        })
    }