Beispiel #1
0
 public void TestTransport()
 {
     using (var transport = new Cmpp30Transport(_config))
     {
         transport.OnCmppMessageReceive += transport_OnCmppMessageReceive;
         transport.Connect();
         Assert.True(transport.Connected);
         var dt = DateTime.Now;
         transport.Send(_seq++, new CmppConnect
         {
             TimeStamp = uint.Parse(string.Format("{0:MMddhhmmss}", dt)),
             AuthenticatorSource = CreateAuthenticatorSource(dt),
             Version = CmppConstants.Version,
             SourceAddress = _config.GatewayUsername,
         });
         Assert.True(_connectEvent.WaitOne(5000));
         Console.WriteLine("Client connected.");
         transport.Send(_seq++, new CmppActiveTest());
         Assert.True(_activeResponse.WaitOne(5000));
         transport.Send(_seq++, new CmppActiveTest());
         Assert.True(_activeResponse.WaitOne(5000));
         transport.Send(_seq++, new CmppActiveTest());
         Assert.True(_activeResponse.WaitOne(5000));
         transport.Send(_seq++, new CmppActiveTest());
         Assert.True(_activeResponse.WaitOne(5000));
         transport.Send(_seq++, new CmppActiveTest());
         Assert.True(_activeResponse.WaitOne(5000));
         transport.Send(_seq++, new CmppActiveTest());
         Assert.True(_activeResponse.WaitOne(5000));
     }
 }