[feat] Add listenerName to client config (#375)

* Allow passing listenerName to client config

* Add listener to test conf, e2e test

(cherry picked from commit 81ab43d8f63dfe93567d197cc2e4d56d69075d6a)
diff --git a/index.d.ts b/index.d.ts
index c416ee2..4680d81 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -30,6 +30,7 @@
   tlsValidateHostname?: boolean;
   tlsAllowInsecureConnection?: boolean;
   statsIntervalInSeconds?: number;
+  listenerName?: string;
   log?: (level: LogLevel, file: string, line: number, message: string) => void;
 }
 
diff --git a/src/Client.cc b/src/Client.cc
index f557a08..e3cbb72 100644
--- a/src/Client.cc
+++ b/src/Client.cc
@@ -40,6 +40,7 @@
 static const std::string CFG_TLS_ALLOW_INSECURE = "tlsAllowInsecureConnection";
 static const std::string CFG_STATS_INTERVAL = "statsIntervalInSeconds";
 static const std::string CFG_LOG = "log";
+static const std::string CFG_LISTENER_NAME = "listenerName";
 
 LogCallback *Client::logCallback = nullptr;
 
@@ -186,6 +187,11 @@
     pulsar_client_configuration_set_stats_interval_in_seconds(cClientConfig.get(), statsIntervalInSeconds);
   }
 
+  if (clientConfig.Has(CFG_LISTENER_NAME) && clientConfig.Get(CFG_LISTENER_NAME).IsString()) {
+    Napi::String listenerName = clientConfig.Get(CFG_LISTENER_NAME).ToString();
+    pulsar_client_configuration_set_listener_name(cClientConfig.get(), listenerName.Utf8Value().c_str());
+  }
+
   try {
     this->cClient = std::shared_ptr<pulsar_client_t>(
         pulsar_client_create(serviceUrl.Utf8Value().c_str(), cClientConfig.get()), pulsar_client_free);
diff --git a/tests/conf/standalone.conf b/tests/conf/standalone.conf
index 2310724..b3618fa 100755
--- a/tests/conf/standalone.conf
+++ b/tests/conf/standalone.conf
@@ -38,6 +38,13 @@
 # Hostname or IP address the service advertises to the outside world. If not set, the value of InetAddress.getLocalHost().getHostName() is used.
 advertisedAddress=localhost
 
+# Used to specify multiple advertised listeners for the broker.
+# The value must format as <listener_name>:pulsar://<host>:<port>,
+# multiple listeners should separate with commas.
+# Do not use this configuration with advertisedAddress and brokerServicePort.
+# The Default value is absent means use advertisedAddress and brokerServicePort.
+advertisedListeners=localhost6650:pulsar://localhost:6650,localhost6651:pulsar+ssl://localhost:6651,localhost8443:pulsar+ssl://localhost:8443
+
 # Name of the cluster to which this broker belongs to
 clusterName=standalone
 
diff --git a/tests/end_to_end.test.js b/tests/end_to_end.test.js
index df239d9..1a551de 100644
--- a/tests/end_to_end.test.js
+++ b/tests/end_to_end.test.js
@@ -23,15 +23,16 @@
 (() => {
   describe('End To End', () => {
     test.each([
-      ['pulsar://localhost:6650'],
-      ['pulsar+ssl://localhost:6651'],
-      ['http://localhost:8080'],
-      ['https://localhost:8443'],
-    ])('Produce/Consume to %s', async (serviceUrl) => {
+      { serviceUrl: 'pulsar://localhost:6650', listenerName: undefined },
+      { serviceUrl: 'pulsar+ssl://localhost:6651', listenerName: 'localhost6651' },
+      { serviceUrl: 'http://localhost:8080', listenerName: undefined },
+      { serviceUrl: 'https://localhost:8443', listenerName: 'localhost8443' },
+    ])('Produce/Consume to $serviceUrl', async ({ serviceUrl, listenerName }) => {
       const client = new Pulsar.Client({
         serviceUrl,
         tlsTrustCertsFilePath: `${__dirname}/certificate/server.crt`,
         operationTimeoutSeconds: 30,
+        listenerName,
       });
 
       const topic = 'persistent://public/default/produce-consume';