       enter: ->
         @emptyMessageBuffer()
       events:
+        socketError: (error) ->
+          @transitionTo(@STATE.FINAL)
         connectTimeout: ->
           @transitionTo(@STATE.FINAL)
         packet: (packet) ->

      throw new Error("No event '#{eventName}' in state '#{@state.name}'")

  socketError: (error) =>
    message = "connection to #{@config.server}:#{@config.options.port} failed"

    @debug.log(message)
    @emit('connect', message)
    @dispatchEvent('socketError', error)

  socketConnect: =>

    SENT_LOGIN7_WITH_STANDARD_LOGIN:
      name: 'SentLogin7WithStandardLogin'
      events:
        socketError: (error) ->
          @transitionTo(@STATE.FINAL)
        connectTimeout: ->
          @transitionTo(@STATE.FINAL)
        packet: (packet) ->
