Expect(password).To(Equal(remoteAgentClient.HttpAuth.Password))

			Ω([]string{"DELETE", "GET"}).Should(ContainElement(r.Method))
			Ω(r.URL.Path).Should(Equal("/"))
			agentCalled++
			w.WriteHeader(status)
			if r.Method == "GET" {
				w.Write([]byte("{\"port\": 12345, \"password\": \"super-secret\"}"))
			}
		})

		listener, err := net.Listen("tcp", hostAndPort)
		Ω(err).ShouldNot(HaveOccurred())

		server = httptest.NewUnstartedServer(handler)
		server.Listener = listener
		server.Start()
		Eventually(isListeningChecker(hostAndPort)).Should(BeTrue())
	})

	AfterEach(func() {
		server.Close()
		Eventually(isListeningChecker(hostAndPort)).Should(BeFalse())
	})

	Describe("#Reset", func() {
		Context("when the DELETE request is successful", func() {
			BeforeEach(func() {
				status = http.StatusOK
			})