public void TestFoundNameByTransport() { // create bus attachment AllJoyn.BusAttachment bus = new AllJoyn.BusAttachment("BusListenerTest", true); AllJoyn.QStatus status = AllJoyn.QStatus.FAIL; // start the bus attachment status = bus.Start(); Assert.Equal(AllJoyn.QStatus.OK, status); // connect to the bus status = bus.Connect(AllJoynTestCommon.GetConnectSpec()); Assert.Equal(AllJoyn.QStatus.OK, status); listenerRegistered = false; foundAdvertisedName = false; nameOwnerChanged = false; transportFound = AllJoyn.TransportMask.None; // register the bus listener AllJoyn.BusListener busListener = new TestBusListener(this); bus.RegisterBusListener(busListener); Wait(MaxWaitTime); Assert.Equal(true, listenerRegistered); AllJoyn.SessionOpts sessionOpts = new AllJoyn.SessionOpts( AllJoyn.SessionOpts.TrafficType.Messages, false, AllJoyn.SessionOpts.ProximityType.Any, AllJoyn.TransportMask.Any); // advertise the name, & see if we find it status = bus.FindAdvertisedNameByTransport(ObjectName, AllJoyn.TransportMask.Local); Assert.Equal(AllJoyn.QStatus.OK, status); status = bus.AdvertiseName(ObjectName, sessionOpts.Transports); Assert.Equal(AllJoyn.QStatus.OK, status); Wait(MaxWaitTime); Assert.Equal(true, foundAdvertisedName); Assert.Equal(AllJoyn.TransportMask.Local, transportFound); status = bus.CancelAdvertisedName(ObjectName, sessionOpts.Transports); Assert.Equal(AllJoyn.QStatus.OK, status); status = bus.CancelFindAdvertisedNameByTransport(ObjectName, AllJoyn.TransportMask.Local); Assert.Equal(AllJoyn.QStatus.OK, status); foundAdvertisedName = false; status = bus.AdvertiseName(ObjectName, sessionOpts.Transports); Assert.Equal(AllJoyn.QStatus.OK, status); Wait(TimeSpan.FromSeconds(1)); Assert.Equal(false, foundAdvertisedName); busListener.Dispose(); bus.Dispose(); }