/// <summary>
        /// Initializes a new instance of the <see cref="T:SmartGlass.Channels.AuxiliaryStreamClient"/> class.
        /// </summary>
        /// <param name="addressOrHostname">Address or hostname to connect to.</param>
        /// <param name="port">Port to connect to.</param>
        /// <param name="cryptoContext">Crypto context.</param>
        internal AuxiliaryStreamClient(
            string addressOrHostname,
            int port,
            AuxiliaryStreamCryptoContext cryptoContext)
        {
            _client            = new TcpClient();
            _addressOrHostname = addressOrHostname;
            _port = port;

            _cryptoContext = cryptoContext;
        }
        public async Task <AuxiliaryStreamClient> OpenAuxiliaryStreamAsync()
        {
            var auxiliaryStreamMessage = await _transport.WaitForMessageAsync <AuxiliaryStreamMessage>(
                TimeSpan.FromSeconds(1),
                () => _transport.SendAsync(new AuxiliaryStreamMessage()).GetAwaiter().GetResult(),
                m => m.ConnectionInfo != null);

            var cryptoContext = new AuxiliaryStreamCryptoContext(
                auxiliaryStreamMessage.ConnectionInfo.CryptoKey,
                auxiliaryStreamMessage.ConnectionInfo.ServerInitVector,
                auxiliaryStreamMessage.ConnectionInfo.ClientInitVector,
                auxiliaryStreamMessage.ConnectionInfo.SignHash);

            var client = new AuxiliaryStreamClient(
                auxiliaryStreamMessage.ConnectionInfo.Endpoints[0].Host,
                int.Parse(auxiliaryStreamMessage.ConnectionInfo.Endpoints[0].Service),
                cryptoContext);

            await client.ConnectAsync();

            return(client);
        }