docs: function Connection(socket) {
    var self = this;
    
    events.EventEmitter.call(this);
    this._methods = {};
    this._socket = socket || new net.Socket();
    this._socket.setEncoding('utf8');
    this._socket.addListener('connect', function() {
      var remote = new Remote(self);
      self.emit('connect', remote);
    });
    this._socket.addListener('data', function(data) {
      //console.log('RECV: ' + data);
      self._parser.parse(data);
    });
    this._socket.addListener('end', this.emit.bind(this, 'end'));
    this._socket.addListener('timeout', this.emit.bind(this, 'timeout'));
    this._socket.addListener('drain', this.emit.bind(this, 'drain'));
    this._socket.addListener('error', this.emit.bind(this, 'error'));
    this._socket.addListener('close', this.emit.bind(this, 'close'));
    
    this._parser = new jsonsp.Parser(function(obj) {
      if (obj.result !== undefined || obj.error !== undefined) {
        self.emit('response', obj);
      } else if (obj.id !== null) {
        self.emit('request', obj);
        self._handleRequest(obj);
      } else {
        self.emit('notification', obj);
        self._handleRequest(obj);
      }
    });
    this._parser.addListener('error', function(err) {
      self._socket.destroy();
      self.emit('error', err);
    })
  }