r := presp.CommandID == command.CommandID
				lock.Unlock()
				return r
			}).Should(Equal(true))

			By("Update command results to gateway agent")
			commandResults := fmt.Sprintf("{\"commandID\":\"%s\",\"actionResults\":[{\"turnPower\":{\"succeeded\":true}}]}", presp.CommandID)
			err = util.PublishCommandResults(client, app, newVid, commandResults)
			Expect(err).To(Succeed())

			By("Report connection")
			err = util.ReportConnectStatus(client, app, newVid, thingProperties)
			Expect(err).To(Succeed())
			By("Check end-node status, should be connection")
			Eventually(func() bool {
				resp, err := util.GetNode(app, ut, enID)
				if err != nil {
					return false
				}
				return resp.Online == true
			}, 2*time.Second, 200*time.Millisecond).Should(Equal(true))

			By("Report disconnection")
			err = util.ReportDisconnectStatus(client, app, newVid)
			Expect(err).To(Succeed())

			By("Check end-node status, should be disconnection")
			Eventually(func() bool {
				resp, err := util.GetNode(app, ut, enID)
				if err != nil {
					return false
		By("init mqtt client")
		c, err := util.NewClient(tConfig.MqttBroker, app, uuid.NewV4().String())
		Expect(err).To(Succeed())
		client = c
	})

	AfterEach(func() {

		By("check auto disconnect of endnode after converter is disconnect")
		if client.IsConnected() {
			client.Disconnect(0)
		}

		By("Check end-node status, should be disconnection")
		Eventually(func() bool {
			resp, err := util.GetNode(app, user.Token, enID)
			if err != nil {
				return false
			}
			return resp.Online == false
		}).Should(Equal(true))

		By("Delete endnode after test")
		// Delete endnode
		Expect(util.DeleteThing(app, user, enID)).To(Succeed())
	})

	It("Should success", func() {
		var (
			newVid string
			t      string