Exemple #1
0
        public void TearDown()
        {
            if(server != null)
            {
                server.Close();
                server = null;
            }

            if(client != null)
            {
                client.Close();
                client = null;
            }
        }
Exemple #2
0
        /// <inheritdoc/>    
        /// <remarks>
        /// Calling this will display a form to the user to enter sharing
        /// settings.
        /// </remarks>
        public void Share(ISynchronizationSession session)
        {
            TcpShareForm form = new TcpShareForm();
            form.Submit += delegate
            {
                form.Enabled = false;
                session.State = SessionStates.AwaitingConnection;
                form.Invoke((Action) delegate
                {
                    form.Dispose();
                });
                TcpServerConnection connection = new TcpServerConnection(form.Port);

                connection.ClientConnected += delegate
                {
                    OnHostSession(new HostSessionEventArgs(session, connection));
                };
            };
            form.ShowDialog();
        }
Exemple #3
0
 public void SetUp()
 {
     server = new TcpServerConnection(port);
     client = new TcpClientConnection("localhost", port);
 }
Exemple #4
0
        public void TestServerShutdown()
        {
            string serverReceived = "";
            bool connectionClosed = false;

            server.Received += delegate(object sender, ReceivedEventArgs e)
            {
                serverReceived += e.Message.ToString();
            };

            client.ConnectionClosed += delegate(object sender, EventArgs e)
            {
                connectionClosed = true;
            };

            string text = "Good day to you, sir";

            client.Send(text);

            TestUtil.WaitAreEqual(text, () => serverReceived, 250);
            server.Close();
            server = null;

            TestUtil.WaitAreEqual(true, () => connectionClosed, 750);
        }