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: lib.rs
    path of file: ./repos/diem/network/socket-bench-server/src
    
    the code of the file until where you have to start completion: // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0

#![forbid(unsafe_code)]

use diem_config::network_id::NetworkContext;
use diem_crypto::{test_utils::TEST_SEED, x25519, Uniform as _};
use diem_logger::prelude::*;
use diem_types::network_address::NetworkAddress;
use futures::{
    future::Future,
    io::{AsyncRead, AsyncWrite},
    sink::SinkExt,
    stream::{Stream, StreamExt},
};
use memsocket::MemorySocket;
use netcore::transport::{
    memory::MemoryTransport,
    tcp::{TcpSocket, TcpTransport},
    Transport, TransportExt,
};
use network::{
    constants,
    noise::{stream::NoiseStream, HandshakeAuthMode, NoiseUpgrader},
    protocol
    
pub fn build_memsocket_noise_transport() -> impl Transport<Output = NoiseStream<MemorySocket>> {
    MemoryTransport::default().and_then(move |socket, addr, origin| async move {
        let mut rng: StdRng = SeedableRng::from_seed(TEST_SEED);
        let private = x25519::PrivateKey::generate(&mut rng);
        let public = private.public_key();
        let peer_id = diem_types::account_address::from_identity_public_key(public);
        let noise_config = Arc::new(NoiseUpgrader::new(
            NetworkContext::mock_with_peer_id(peer_id),
            private,
            HandshakeAuthMode::server_only(),
        ));
        let remote_public_key = addr.find_noise_proto();
        let (_remote_static_key, socket) = noise_config
            .upgrade_with_noise(socket, origin, remote_public_key)
            .await
            .map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
        Ok(socket)
    })
}