//---------------------------------------------------------------------
        // Ctor.
        //---------------------------------------------------------------------

        protected SshConnectionBase(
            string username,
            IPEndPoint endpoint,
            ISshKey key,
            ReceivedAuthenticationPromptHandler authenticationPromptHandler,
            ReceiveStringDataHandler receiveHandler,
            ReceiveErrorHandler receiveErrorHandler,
            Encoding dataEncoding)
            : base(username, endpoint, key)
        {
            this.receiveDecoder = new StreamingDecoder(
                dataEncoding,
                s => receiveHandler(s));

            this.receiveDataHandler = (buf, offset, count)
                                      => this.receiveDecoder.Decode(buf, (int)offset, (int)count);

            this.receiveErrorHandler         = receiveErrorHandler;
            this.authenticationPromptHandler = authenticationPromptHandler;
        }
        //---------------------------------------------------------------------
        // Ctor.
        //---------------------------------------------------------------------

        public SshShellConnection(
            string username,
            IPEndPoint endpoint,
            ISshKey key,
            string terminal,
            TerminalSize terminalSize,
            CultureInfo language,
            ReceivedAuthenticationPromptHandler authenticationPromptHandler,
            ReceiveStringDataHandler receiveDataHandler,
            ReceiveErrorHandler receiveErrorHandler)
            : base(
                username,
                endpoint,
                key,
                authenticationPromptHandler,
                receiveDataHandler,
                receiveErrorHandler,
                Encoding)
        {
            this.terminal     = terminal;
            this.terminalSize = terminalSize;
            this.language     = language;
        }