Microsoft.Protocols.TestTools.StackSdk.CommonStack.HttpServerTransport.GetListenPrefix C# (CSharp) Method

GetListenPrefix() private method

Get the listen prefix.
private GetListenPrefix ( TransferProtocol transferProtocol, int hostedCacheModeListenPort, string resource ) : string
transferProtocol TransferProtocol The transport type will be used
hostedCacheModeListenPort int The hosted cache mode listen port.
resource string The customer resource data.
return string
        private string GetListenPrefix(
            TransferProtocol transferProtocol,
            int hostedCacheModeListenPort,
            string resource)
        {
            string transportTypeStr;
            string listenPrefix = null;

            if (resource == null)
            {
                resource = string.Empty;
            }
            else if (!resource.EndsWith("/") && resource != string.Empty)
            {
                resource = resource + "/";
            }

            if (transferProtocol == TransferProtocol.HTTPS)
            {
                transportTypeStr = "https";
            }
            else if (transferProtocol == TransferProtocol.HTTP)
            {
                transportTypeStr = "http";
            }
            else
            {
                throw new ArgumentException("The supported transport type in pchc is http or https for this version.", "transportType");
            }

            listenPrefix =
                        transportTypeStr + "://+:"
                        + hostedCacheModeListenPort + "/" + resource;

            return listenPrefix;
        }