public bool Execute()
 {
     try
     {
         _tcpClient = new TcpClient();
         _tcpClient.Connect(CreateEndpoint());
         _adapter = new PipeAdapter(_tcpClient.GetStream());
         return(true);
     }
     catch (Exception e)
     {
         Log.Error(e);
         return(false);
     }
 }
        private PipeAdapter CreatePipeAdapter(TcpClient client)
        {
            var adapter = new PipeAdapter(client.GetStream());

            Task.Run(() => adapter.ExecuteAsync(_cts.Token));

            adapter.WhenReceived
            .Select(d => new NetworkContent(_receiver.Encoding.GetString(d.ToArray()), client.Client.RemoteEndPoint))
            .Subscribe(SequenceReceived);

            adapter.WhenTerminated
            .Select(d => (adapter, client.Client.RemoteEndPoint))
            .Subscribe(Disconnect);

            return(adapter);
        }