static void ConfigureSendCommand(CommandLineApplication hcCommand)
        {
            hcCommand.RelayCommand("send", (sendCmd) =>
            {
                sendCmd.Description          = "HybridConnection send command";
                var pathArgument             = sendCmd.Argument("path", "HybridConnection path");
                var connectionStringArgument = sendCmd.Argument("connectionString", "Relay ConnectionString");

                var numberOption        = sendCmd.Option(CommandStrings.NumberTemplate, CommandStrings.NumberDescription, CommandOptionType.SingleValue);
                var methodOption        = sendCmd.Option("-m|--method <method>", "The HTTP Method (GET|POST|PUT|DELETE|WEBSOCKET)", CommandOptionType.SingleValue);
                var requestOption       = sendCmd.Option(CommandStrings.RequestTemplate, CommandStrings.RequestDescription, CommandOptionType.SingleValue);
                var requestLengthOption = sendCmd.Option(CommandStrings.RequestLengthTemplate, CommandStrings.RequestLengthDescription, CommandOptionType.SingleValue);

                sendCmd.OnExecute(async() =>
                {
                    string connectionString = ConnectionStringUtility.ResolveConnectionString(connectionStringArgument);
                    if (string.IsNullOrEmpty(connectionString))
                    {
                        TraceMissingArgument(connectionStringArgument.Name);
                        sendCmd.ShowHelp();
                        return(1);
                    }

                    var connectionStringBuilder        = new RelayConnectionStringBuilder(connectionString);
                    connectionStringBuilder.EntityPath = pathArgument.Value ?? connectionStringBuilder.EntityPath ?? DefaultPath;

                    int number            = GetIntOption(numberOption, 1);
                    string method         = GetStringOption(methodOption, "GET");
                    string requestContent = GetMessageBody(requestOption, requestLengthOption, null);
                    await HybridConnectionTests.VerifySendAsync(connectionStringBuilder, number, method, requestContent, RelayTraceSource.Instance);
                    return(0);
                });
            });
        }
        static void ConfigureListenCommand(CommandLineApplication hcCommand)
        {
            hcCommand.RelayCommand("listen", (listenCmd) =>
            {
                listenCmd.Description        = "HybridConnection listen command";
                var pathArgument             = listenCmd.Argument("path", "HybridConnection path");
                var connectionStringArgument = listenCmd.Argument("connectionString", "Relay ConnectionString");

                var responseOption            = listenCmd.Option("--response <response>", "Response to return", CommandOptionType.SingleValue);
                var responseLengthOption      = listenCmd.Option("--response-length <responseLength>", "Length of response to return", CommandOptionType.SingleValue);
                var responseChunkLengthOption = listenCmd.Option("--response-chunk-length <responseLength>", "Length of response to return", CommandOptionType.SingleValue);
                var statusCodeOption          = listenCmd.Option("--status-code <statusCode>", "The HTTP Status Code to return (200|201|401|404|etc.)", CommandOptionType.SingleValue);
                var statusDescriptionOption   = listenCmd.Option("--status-description <statusDescription>", "The HTTP Status Description to return", CommandOptionType.SingleValue);

                listenCmd.OnExecute(async() =>
                {
                    string connectionString = ConnectionStringUtility.ResolveConnectionString(connectionStringArgument);
                    if (string.IsNullOrEmpty(connectionString))
                    {
                        TraceMissingArgument(connectionStringArgument.Name);
                        listenCmd.ShowHelp();
                        return(1);
                    }

                    string response                    = GetMessageBody(responseOption, responseLengthOption, "<html><head><title>Azure Relay HybridConnection</title></head><body>Response Body from Listener</body></html>");
                    var connectionStringBuilder        = new RelayConnectionStringBuilder(connectionString);
                    connectionStringBuilder.EntityPath = pathArgument.Value ?? connectionStringBuilder.EntityPath ?? DefaultPath;
                    var statusCode          = (HttpStatusCode)GetIntOption(statusCodeOption, 200);
                    int responseChunkLength = GetIntOption(responseChunkLengthOption, response.Length);
                    return(await HybridConnectionTests.VerifyListenAsync(RelayTraceSource.Instance, connectionStringBuilder, response, responseChunkLength, statusCode, statusDescriptionOption.Value()));
                });
            });
        }
        static void ConfigureTestCommand(CommandLineApplication hcCommand)
        {
            hcCommand.RelayCommand("test", (testCmd) =>
            {
                testCmd.Description          = "HybridConnection tests";
                var connectionStringArgument = testCmd.Argument("connectionString", "Relay ConnectionString");

                testCmd.OnExecute(async() =>
                {
                    string connectionString = ConnectionStringUtility.ResolveConnectionString(connectionStringArgument);
                    if (string.IsNullOrEmpty(connectionString))
                    {
                        TraceMissingArgument(connectionStringArgument.Name);
                        testCmd.ShowHelp();
                        return(1);
                    }

                    return(await HybridConnectionTests.RunTestsAsync(new RelayConnectionStringBuilder(connectionString), RelayTraceSource.Instance));
                });
            });
        }