Disconnect() public method

public Disconnect ( string connectSpec ) : QStatus
connectSpec string
return QStatus
Exemplo n.º 1
0
		public void TestStopDisconnected()
		{
			// 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;
			busDisconnected = false;
			busStopping = false;

			// register the bus listener
			AllJoyn.BusListener busListener = new TestBusListener(this);
			bus.RegisterBusListener(busListener);
			Wait(MaxWaitTime);
			Assert.Equal(true, listenerRegistered);

			// test disconnecting from the bus
			status = bus.Disconnect(AllJoynTestCommon.GetConnectSpec());
			Assert.Equal(AllJoyn.QStatus.OK, status);
			Wait(MaxWaitTime);
			Assert.Equal(true, busDisconnected);

			// test stopping the bus
			status = bus.Stop();
			Assert.Equal(AllJoyn.QStatus.OK, status);
			Wait(MaxWaitTime);
			Assert.Equal(true, busStopping);

			busListener.Dispose();
			bus.Dispose();
		}
Exemplo n.º 2
0
		public void Disconnect()
		{
			AllJoyn.BusAttachment busAttachment = new AllJoyn.BusAttachment("BusAttachmentTest", true);
			Assert.NotNull(busAttachment);

			Assert.Equal(AllJoyn.QStatus.BUS_BUS_NOT_STARTED, busAttachment.Disconnect(AllJoynTestCommon.GetConnectSpec()));

			Assert.Equal(AllJoyn.QStatus.OK, busAttachment.Start());

			Assert.Equal(AllJoyn.QStatus.BUS_NOT_CONNECTED, busAttachment.Disconnect(AllJoynTestCommon.GetConnectSpec()));

			Assert.Equal(AllJoyn.QStatus.OK, busAttachment.Connect(AllJoynTestCommon.GetConnectSpec()));

			Assert.True(busAttachment.IsConnected);

			Assert.Equal(AllJoyn.QStatus.OK, busAttachment.Disconnect(AllJoynTestCommon.GetConnectSpec()));

			Assert.False(busAttachment.IsConnected);

			busAttachment.Stop();
			busAttachment.Join();

			busAttachment.Dispose();
		}