private void btnConnect_Click(object sender, EventArgs e)
        {
            string remoteIP = txtRemoteIP.Text;
            int remotePort = int.Parse(txtRemotePort.Text);
            int port = int.Parse(txtPort.Text);

            connector = new UdpConnector(remoteIP, remotePort, port);
            udpMessages = new UdpIntegration(connector);

            txtRemoteIP.Enabled = false;
            txtRemotePort.Enabled = false;
            txtPort.Enabled = false;
            btnConnect.Enabled = false;
            btnDisconnect.Enabled = true;
            txtMessage.Enabled = true;
            btnSend.Enabled = true;

            verifyMessages = new System.Timers.Timer();
            verifyMessages.Interval = 500;
            verifyMessages.Enabled = true;

            verifyMessages.Elapsed += new ElapsedEventHandler(receive);
        }
Exemplo n.º 2
0
        public void testSendMessageWithoutConnectionReturnException()
        {
            //Arrange
            String message = "Teste";
            var data = Encoding.ASCII.GetBytes(message);

            var connector = new UdpConnector("127.0.0.1", 9999, 9998);

            var udp = new UdpIntegration(connector);

            //Act and Assert
            udp.close();
            udp.send(message);
        }