var onRcv mqtt.MessageHandler = func(client mqtt.Client, m mqtt.Message) {
				p := m.Payload()
				defer GinkgoRecover()
				lock.Lock()
				err := json.Unmarshal(p, &command)
				lock.Unlock()
				Expect(err).To(Succeed())
			}
			token := client.Subscribe(topic, 0, onRcv)
			Eventually(func() error {
				return token.Error()
			}).Should(Succeed())

			By("Send command to end-node")
			commandToSend := "{\"schema\":\"ledDemo\",\"schemaVersion\":1,\"actions\":[{\"turnPower\":{\"power\":true}}]}"
			presp, err := util.PostCommand(app, user, enID, []byte(commandToSend))
			Expect(err).To(Succeed())

			By("Wait and confirm received commandID")
			Eventually(func() bool {
				lock.Lock()
				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())
		var onRcv mqtt.MessageHandler = func(client mqtt.Client, m mqtt.Message) {
			p := m.Payload()
			defer GinkgoRecover()
			lock.Lock()
			err := json.Unmarshal(p, &command)
			lock.Unlock()
			Expect(err).To(Succeed())
		}
		token := client.Subscribe(topic, 0, onRcv)
		Eventually(func() error {
			return token.Error()
		}).Should(Succeed())

		By("Send command to end-node for master app")
		commandToSend := "{\"schema\":\"ledDemo\",\"schemaVersion\":1,\"actions\":[{\"turnPower\":{\"power\":true}}]}"
		presp, err := util.PostCommand(master, mUser, mEnID, []byte(commandToSend))
		Expect(err).To(Succeed())

		By("Wait and confirm received commandID for master app")
		Eventually(func() bool {
			lock.Lock()
			r := presp.CommandID == command.CommandID
			lock.Unlock()
			return r
		}).Should(Equal(true))

		By("Init converter for end-node app")
		c, err = util.NewClient(tConfig.MqttBroker, en, uuid.NewV4().String())
		client1 = c
		Expect(err).To(Succeed())