public static async Task <RelayMetadata> Parse(ILogger logger, HybridConnectionListener listener)
        {
            var info = await listener.GetRuntimeInformationAsync(default(CancellationToken));

            var entityPath = GetEntityPath(listener);

            try
            {
                var channelFactories = new Dictionary <int, ILocalDataChannelFactory>();

                var metadata = JArray.Parse(info.UserMetadata);

                foreach (var item in metadata)
                {
                    var key = item["key"].Value <string>();
                    if (!int.TryParse(key, out var configurationKey))
                    {
                        continue;
                    }

                    var factory = ParseEndpoint(logger, configurationKey, item["value"].Value <string>(), entityPath);
                    if (factory != null)
                    {
                        channelFactories[configurationKey] = factory;
                    }
                }

                if (!channelFactories.Any())
                {
                    throw new ConfigurationErrorException($"There is no any endpoint configured for {listener.Address}");
                }

                return(new RelayMetadata(channelFactories));
            }
            catch (Exception e) when(!(e is ConfigurationErrorException))
            {
                throw new ConfigurationErrorException($"Failed to parse the {listener.Address} relay user metadata", e);
            }
        }