// Connect initializes the Joule for use with the Arduino beakout board
163013
func (e *Adaptor) Connect() (err error) {
	e.mutex.Lock()
	defer e.mutex.Unlock()

	e.digitalPins = make(map[int]*sysfs.DigitalPin)
	e.pwmPins = make(map[int]*sysfs.PWMPin)
	err = e.connect(e)
	return
}
631388
func (d *HypervPS4Driver) Connect(vmName string) (context.CancelFunc, error) {
	return hyperv.ConnectVirtualMachine(vmName)
}
1068514
func (a *Adaptor) Connect() (err error) {
	d, err := a.connect(a)
	if err != nil {
		return err
	}
	a.drone = d
	return
}
501424
func (clone *Clone) Connect(address, service string) {
	clone.pipe.SendMessage("CONNECT", address, service)
}
702169
func (f *Fluent) connect() (err error) {

	switch f.Config.FluentNetwork {
	case "tcp":
		f.conn, err = net.DialTimeout(f.Config.FluentNetwork, f.Config.FluentHost+":"+strconv.Itoa(f.Config.FluentPort), f.Config.Timeout)
	case "unix":
		f.conn, err = net.DialTimeout(f.Config.FluentNetwork, f.Config.FluentSocketPath, f.Config.Timeout)
	default:
		err = net.UnknownNetworkError(f.Config.FluentNetwork)
	}
	return err
}
169315
func (c *Client) connect() byte {
	DEBUG.Println(NET, "connect started")

	ca, err := packets.ReadPacket(c.conn)
	if err != nil {
		ERROR.Println(NET, "connect got error", err)
		return packets.ErrNetworkError
	}
	if ca == nil {
		ERROR.Println(NET, "received nil packet")
		return packets.ErrNetworkError
	}

	msg, ok := ca.(*packets.ConnackPacket)
	if !ok {
		ERROR.Println(NET, "received msg that was not CONNACK")
		return packets.ErrNetworkError
	}

	DEBUG.Println(NET, "received connack")
	return msg.ReturnCode
}
632778
func (c Config) Connect(ctx context.Context, wlog io.Writer) (*Session, error) {
	// start with the default Dialer from http.DefaultTransport
	transport := wirelog.NewHTTPTransport()
	// if there is a need to proxy
	if c.Proxy != "" {
		log.Printf("Using proxy %s", c.Proxy)
		d, err := proxy.SOCKS5("tcp", c.Proxy, nil, proxy.Direct)
		if err != nil {
			return nil, fmt.Errorf("rets proxy: %v", err)
		}
		transport.Dial = d.Dial
	}
	// wire logging
	if wlog != nil {
		err := wirelog.LogToWriter(transport, wlog, true, true)
		if err != nil {
			return nil, fmt.Errorf("wirelog setup: %v", err)
		}
		log.Printf("wire logging enabled %s", wlog)
	}

	// should we throw an err here too?
	sess, err := rets.DefaultSession(
		c.Username,
		c.Password,
		c.UserAgent,
		c.UserAgentPw,
		c.RetsVersion,
		transport,
	)
	if err != nil {
		return nil, err
	}
	urls, err := rets.Login(ctx, sess, rets.LoginRequest{URL: c.LoginURL})
	if err != nil {
		return nil, err
	}
	closer := func() error {
		_, err := rets.Logout(ctx, sess, rets.LogoutRequest{URL: urls.Logout})
		return err
	}
	return &Session{
		requester: sess,
		close:     closer,
		urls:      *urls,
	}, err
}
147857
func (r *BinaryInstantiateREST) Connect(ctx context.Context, name string, options runtime.Object, responder rest.Responder) (http.Handler, error) {
	return &binaryInstantiateHandler{
		r:         r,
		responder: responder,
		ctx:       ctx,
		name:      name,
		options:   options.(*buildapi.BinaryBuildRequestOptions),
	}, nil
}
585426
func (c *Client) Connect() error {
	dialer := new(net.Dialer)
	rawConn, err := dialer.Dial("tcp", fmt.Sprintf("%s:%d", c.settings.Hostname, c.settings.Port))
	if err != nil {
		return err
	}

	err = enableKeepAlive(rawConn, 10*time.Second, 2, 5*time.Second)
	if err != nil {
		return err
	}

	c.conn = tls.Client(rawConn, &tls.Config{
		ServerName:         c.settings.Hostname,
		InsecureSkipVerify: true, // x509: cannot verify signature: algorithm unimplemented
	})

	if c.settings.Logger != nil {
		c.settings.Logger.Printf("connected to %s:%d\n", c.settings.Hostname, c.settings.Port)
	}

	// perform login
	resp, err := c.rpc("daemon.login", rencode.NewList(c.settings.Login, c.settings.Password), rencode.Dictionary{})
	if err != nil {
		return err
	}
	if resp.IsError() {
		return resp.RPCError
	}

	// get class of logged-in user
	err = resp.returnValue.Scan(&c.classID)
	if err != nil {
		return err
	}

	if c.settings.Logger != nil {
		c.settings.Logger.Println("login successful as user", c.settings.Login)
	}

	return nil
}
547619
func (e *Echo) Connect(path string, h interface{}, m ...interface{}) {
	e.add(CONNECT, "", path, h, m...)
}
677
func (b *Client) Connect(conn io.ReadWriteCloser) (err error) {
	if b.Connected() {
		return ErrConnected
	}

	b.connection = conn
	b.Reset()
	connected := make(chan bool, 1)
	connectError := make(chan error, 1)

	b.Once(b.Event("ProtocolVersion"), func(data interface{}) {
		e := b.FirmwareQuery()
		if e != nil {
			b.setConnecting(false)
			connectError <- e
		}
	})

	b.Once(b.Event("FirmwareQuery"), func(data interface{}) {
		e := b.CapabilitiesQuery()
		if e != nil {
			b.setConnecting(false)
			connectError <- e
		}
	})

	b.Once(b.Event("CapabilityQuery"), func(data interface{}) {
		e := b.AnalogMappingQuery()
		if e != nil {
			b.setConnecting(false)
			connectError <- e
		}
	})

	b.Once(b.Event("AnalogMappingQuery"), func(data interface{}) {
		b.ReportDigital(0, 1)
		b.ReportDigital(1, 1)
		b.setConnecting(false)
		b.setConnected(true)
		connected <- true
	})

	// start it off...
	b.setConnecting(true)
	b.ProtocolVersionQuery()

	go func() {
		for {
			if !b.Connecting() {
				return
			}
			if e := b.process(); e != nil {
				connectError <- e
				return
			}
			time.Sleep(10 * time.Millisecond)
		}
	}()

	select {
	case <-connected:
	case e := <-connectError:
		return e
	case <-time.After(b.ConnectTimeout):
		return errors.New("unable to connect. Perhaps you need to flash your Arduino with Firmata?")
	}

	go func() {
		for {
			if !b.Connected() {
				break
			}

			if err := b.process(); err != nil {
				b.Publish(b.Event("Error"), err)
			}
		}
	}()

	return
}
667864
func (db *Database) Connect(ctx context.Context) error {
	if err := db.auth.Setup(ctx, db); err != nil {
		return err
	}
	if _, err := db.Send(ctx, &requests.CurrentDatabase{}); err != nil {
		return err
	}
	return nil
}
132022
func (w *WebSocketService) Connect() error {
	var d = websocket.Dialer{
		Subprotocols:    []string{"p1", "p2"},
		ReadBufferSize:  1024,
		WriteBufferSize: 1024,
		Proxy:           http.ProxyFromEnvironment,
	}

	if w.client.WebSocketTLSSkipVerify {
		d.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
	}

	ws, _, err := d.Dial(w.client.WebSocketURL, nil)
	if err != nil {
		return err
	}
	w.ws = ws
	return nil
}
515893
func (r *Route) Connect(handler http.Handler) *Route {
	r.handlers[http.MethodConnect] = handler
	return r
}
1370653
func (d *Driver) connect(ctx context.Context, c *Connector, params connectParams) (*Conn, error) {
	sess, err := connect(ctx, c, d.log, params)
	if err != nil {
		// main server failed, try fail-over partner
		if params.failOverPartner == "" {
			return nil, err
		}

		params.host = params.failOverPartner
		if params.failOverPort != 0 {
			params.port = params.failOverPort
		}

		sess, err = connect(ctx, c, d.log, params)
		if err != nil {
			// fail-over partner also failed, now fail
			return nil, err
		}
	}

	conn := &Conn{
		connector:        c,
		sess:             sess,
		transactionCtx:   context.Background(),
		processQueryText: d.processQueryText,
		connectionGood:   true,
	}
	conn.sess.log = d.log

	return conn, nil
}
781233
func (this *push) connect(url *string) (err error) {
	if nil != this.socket {
		this.socket.Close()
	}
	this.socket, err = nano.NewPushSocket()
	if nil != err {
		return
	}
	_, err = this.socket.Connect(*url)
	return
}
586901
func (c *Client) Connect() (client.Session, error) {
	if c.conn == nil {
		if err := c.initConnection(); err != nil {
			return nil, err
		}
	}
	return &Session{c.conn, c.ch}, nil
}