예제 #1
0
func startClient(URLs ...string) *broker.Client {
	var client *broker.Client
	f := func() error {
		var err error
		client, err = broker.NewClient(URLs...)
		return err
	}
	Eventually(f, 5).ShouldNot(HaveOccurred())
	return client
}
예제 #2
0
		client      *broker.Client
	)

	BeforeEach(func() {
		mockServers = nil
		servers = nil
		var urls []string
		for i := 0; i < 3; i++ {
			mockServer, server := startMockServer()
			mockServers = append(mockServers, mockServer)
			servers = append(servers, server)
			urls = append(urls, "ws"+server.URL[4:])
		}

		var err error
		client, err = broker.NewClient(urls...)
		Expect(err).ToNot(HaveOccurred())
	})

	AfterEach(func() {
		client.Close()
		for _, server := range mockServers {
			close(server.serverCh)
		}

		for _, server := range servers {
			server.CloseClientConnections()
			server.Close()
		}
	})