public void T00_TelnetSuccess()
        {
            ProtocolServiceTestPlugin.Instance.Reset();

            ITCPParameter tcp = _protocolService.CreateDefaultTelnetParameter();

            tcp.Destination = GetTelnetConnectableHost();
            Assert.AreEqual(23, tcp.Port);

            ResultCallback client = new ResultCallback();
            IInterruptable t      = _protocolService.AsyncTelnetConnect(client, tcp);

            client.AssertSuccess();

            ProtocolServiceTestPlugin.Instance.AssertSuccess();
        }
Exemple #2
0
        /// <summary>
        /// Establishes the connection to the remote server; initializes a <see cref="ITCPParameter"/> with the connection properties from
        /// <see cref="BaseConnectionForm{T}.Connection"/> and then calls <see cref="IProtocolService.AsyncTelnetConnect(IInterruptableConnectorClient, ITCPParameter)"/>
        /// to start the connection process.
        /// </summary>
        public override void Connect()
        {
            ITCPParameter tcpParameters = PoderosaProtocolService.CreateDefaultTelnetParameter();

            tcpParameters.Destination = Connection.Host;
            tcpParameters.Port        = Connection.Port;

            PoderosaProtocolService.AsyncTelnetConnect(this, tcpParameters);
        }
            public ITerminalConnection EstablishConnection(IPoderosaMainWindow window, ITerminalParameter destination, ITerminalSettings settings)
            {
                ITCPParameter          tcp = (ITCPParameter)destination.GetAdapter(typeof(ITCPParameter));
                IProtocolService       ps  = TerminalSessionsPlugin.Instance.ProtocolService;
                ISynchronizedConnector sc  = ps.CreateFormBasedSynchronozedConnector(window);
                IInterruptable         t   = ps.AsyncTelnetConnect(sc.InterruptableConnectorClient, tcp);
                ITerminalConnection    con = sc.WaitConnection(t, TerminalSessionsPlugin.Instance.TerminalSessionOptions.TerminalEstablishTimeout);

                AdjustCaptionAndText(settings, tcp.Destination, StartCommandIcon.NewConnection);
                return(con);
            }
Exemple #4
0
        //TODO シリアル用テストケースは追加必要。CygwinはTelnetと同じなのでまあいいだろう

        //TODO ITerminalOutputのテスト。正しく送信されたかを確認するのは難しい感じもするが

        //TODO Reproduceサポートの後、SSH2で1Connection-複数Channelを開き、個別に開閉してみる

        private ITerminalConnection CreateTelnetConnection()
        {
            ITCPParameter tcp = _protocolService.CreateDefaultTelnetParameter();

            tcp.Destination = UnitTestUtil.GetUnitTestConfig("protocols.telnet_connectable");
            Debug.Assert(tcp.Port == 23);

            ISynchronizedConnector sc  = _protocolService.CreateFormBasedSynchronozedConnector(null);
            IInterruptable         t   = _protocolService.AsyncTelnetConnect(sc.InterruptableConnectorClient, tcp);
            ITerminalConnection    con = sc.WaitConnection(t, 5000);

            //Assert.ReferenceEquals(con.Destination, tcp); //なぜか成立しない
            Debug.Assert(con.Destination == tcp);
            _rawsocket    = ((InterruptableConnector)t).RawSocket;
            _testReceiver = new TestReceiver();
            con.Socket.RepeatAsyncRead(_testReceiver);
            return(con);
        }
Exemple #5
0
        protected override void StartConnection()
        {
            ISSHLoginParameter ssh             = (ISSHLoginParameter)_param.GetAdapter(typeof(ISSHLoginParameter));
            ITCPParameter      tcp             = (ITCPParameter)_param.GetAdapter(typeof(ITCPParameter));
            IProtocolService   protocolservice = TerminalSessionsPlugin.Instance.ProtocolService;

            if (ssh != null)
            {
                _connector = protocolservice.AsyncSSHConnect(this, ssh);
            }
            else
            {
                _connector = protocolservice.AsyncTelnetConnect(this, tcp);
            }

            if (_connector == null)
            {
                ClearConnectingState();
            }
        }
Exemple #6
0
        /// <summary>
        /// Start opening session
        /// </summary>
        /// <remarks>
        /// The implementation of this method also do validation of the input values.
        /// </remarks>
        /// <param name="client">an instance who receive the result of opening session.</param>
        /// <param name="terminalSettings">terminal settings is set if this method returns true.</param>
        /// <param name="interruptable">an object for cancellation is set if this method returns true.</param>
        /// <returns>true if the opening session has been started, or false if failed.</returns>
        public bool OpenSession(IInterruptableConnectorClient client, out ITerminalSettings terminalSettings, out IInterruptable interruptable)
        {
            ITCPParameter     telnetParam;
            ITerminalSettings termSettings;
            string            errorMessage;

            if (!Validate(out telnetParam, out termSettings, out errorMessage))
            {
                client.ConnectionFailed(errorMessage);
                terminalSettings = null;
                interruptable    = null;
                return(false);
            }

            IProtocolService protocolservice = TerminalSessionsPlugin.Instance.ProtocolService;

            interruptable    = protocolservice.AsyncTelnetConnect(client, telnetParam);
            terminalSettings = termSettings;
            return(true);
        }