示例#1
0
 public void CallUser()
 {
     if (CurrentUser != null)
     {
         client.Connect(CurrentUser);
     }
 }
 public void ConnectIPV6Test()
 {
     try
     {
         ipv6Protocol.Listen();
         UdpProtocol ipvClient = this.CreateIPV6ClientProtocol(ipv6ServerAddress);
         var         udpSocket = ipvClient.Connect(ipv6ServerAddress, PORT);
         sockets.Add(udpSocket);
         Assert.IsNotNull(udpSocket);
         Assert.IsTrue(udpSocket.Connected, "A connection could not be established.");
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.ToString());
     }
 }
        public void OnConnectionRequestedTest()
        {
            ipv4Protocol.Listen();
            ManualResetEventSlim mevent = new ManualResetEventSlim(false);

            mevent.Reset();
            bool eventInvoked = false;

            ipv4Protocol.OnConnectionRequested += (socket) =>
            {
                eventInvoked = true;
                mevent.Set();
            };
            UdpProtocol ipvClient    = this.CreateIPV4ClientProtocol(clientAddress);
            ISocket     clientSocket = ipvClient.Connect(serverAddress, PORT);

            sockets.Add(clientSocket);

            clientSocket.Send(TestData.GetDummyStream().ToArray());
            mevent.Wait(1000);
            Assert.IsTrue(clientSocket.Connected, "A socket connection was not established.");
            Assert.IsTrue(eventInvoked, "On Connection Requested event was not invoked");
        }
示例#4
0
 public void Connect(User user)
 {
     user.Port += 1;
     udp.Connect(user);
 }