/// <summary> /// Initialize with cmpp 3.0 config /// </summary> /// <param name="config"></param> public Cmpp30Client(Cmpp30Configuration config) { _config = config; _transport = new Cmpp30Transport(config); Status = Cmpp30ClientStatus.Disconnected; _transport.OnCmppMessageReceive += OnCmppMessageReceive; _transport.OnDisconnected += OnTransportDisconnected; }
/// <summary> /// Initialize with cmpp 3.0 config /// </summary> /// <param name="config"></param> public Cmpp30Client(Cmpp30Configuration config) { _config = config; _transport = new Cmpp30Transport(config); Status = Cmpp30ClientStatus.Disconnected; _transport.OnCmppMessageReceive += OnCmppMessageReceive; _transport.OnDisconnected += OnTransportDisconnected; }
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)); } }