code: function Service(name, messages, types, ptcl, server) {
    if (typeof name != 'string') {
      // Let's be helpful in case this class is instantiated directly.
      return Service.forProtocol(name, messages);
    }
  
    this.name = name;
    this._messagesByName = messages || {};
    this.messages = Object.freeze(utils.objectValues(this._messagesByName));
  
    this._typesByName = types || {};
    this.types = Object.freeze(utils.objectValues(this._typesByName));
  
    this.protocol = ptcl;
    // We cache a string rather than a buffer to not retain an entire slab.
    this._hashStr = utils.getHash(JSON.stringify(ptcl)).toString('binary');
    this.doc = ptcl.doc ? '' + ptcl.doc : undefined;
  
    // We add a server to each protocol for backwards-compatibility (to allow the
    // use of `protocol.on`). This covers all cases except the use of the
    // `strictErrors` option, which requires moving to the new API.
    this._server = server || this.createServer({silent: true});
    Object.freeze(this);
  }
docs: An Avro RPC service.
  
  This constructor shouldn't be called directly, but via the
  `Service.forProtocol` method. This function performs little logic to better
  support efficient copy.