diff --git a/test/netstd/Client/Program.cs b/test/netstd/Client/Program.cs
index 72139d9..8d973c4 100644
--- a/test/netstd/Client/Program.cs
+++ b/test/netstd/Client/Program.cs
@@ -52,6 +52,7 @@
                     PrintHelp();
                     return 0;
                 default:
+                    Console.WriteLine("Invalid argument: {0}", firstArg);
                     PrintHelp();
                     return -1;
             }
diff --git a/test/netstd/Client/TestClient.cs b/test/netstd/Client/TestClient.cs
index b2e8cbf..f480846 100644
--- a/test/netstd/Client/TestClient.cs
+++ b/test/netstd/Client/TestClient.cs
@@ -35,6 +35,29 @@
 
 namespace ThriftTest
 {
+    internal enum ProtocolChoice
+    {
+        Binary,
+        Compact,
+        Json
+    }
+
+    // it does not make much sense to use buffered when we already use framed
+    internal enum LayeredChoice
+    {
+        None,
+        Buffered,
+        Framed
+    }
+
+
+    internal enum TransportChoice
+    {
+        Socket,
+        TlsSocket,
+        NamedPipe
+    }
+
     public class TestClient
     {
         private class TestParams
@@ -45,10 +68,9 @@
             public int numThreads = 1;
             public string url;
             public string pipe;
-            public bool buffered;
-            public bool framed;
-            public string protocol;
-            public bool encrypted = false;
+            public LayeredChoice layered = LayeredChoice.None;
+            public ProtocolChoice protocol = ProtocolChoice.Binary;
+            public TransportChoice transport = TransportChoice.Socket;
 
             internal void Parse( List<string> args)
             {
@@ -65,26 +87,28 @@
                     else if (args[i].StartsWith("--pipe="))
                     {
                         pipe = args[i].Substring(args[i].IndexOf("=") + 1);
-                        Console.WriteLine("Using named pipes transport");
+                        transport = TransportChoice.NamedPipe;
                     }
                     else if (args[i].StartsWith("--host="))
                     {
                         // check there for ipaddress
                         host = new IPAddress(Encoding.Unicode.GetBytes(args[i].Substring(args[i].IndexOf("=") + 1)));
+                        if (transport != TransportChoice.TlsSocket)
+                            transport = TransportChoice.Socket;
                     }
                     else if (args[i].StartsWith("--port="))
                     {
                         port = int.Parse(args[i].Substring(args[i].IndexOf("=") + 1));
+                        if (transport != TransportChoice.TlsSocket)
+                            transport = TransportChoice.Socket;
                     }
                     else if (args[i] == "-b" || args[i] == "--buffered" || args[i] == "--transport=buffered")
                     {
-                        buffered = true;
-                        Console.WriteLine("Using buffered sockets");
+                        layered = LayeredChoice.Buffered;
                     }
                     else if (args[i] == "-f" || args[i] == "--framed" || args[i] == "--transport=framed")
                     {
-                        framed = true;
-                        Console.WriteLine("Using framed transport");
+                        layered = LayeredChoice.Framed;
                     }
                     else if (args[i] == "-t")
                     {
@@ -92,29 +116,77 @@
                     }
                     else if (args[i] == "--binary" || args[i] == "--protocol=binary")
                     {
-                        protocol = "binary";
-                        Console.WriteLine("Using binary protocol");
+                        protocol = ProtocolChoice.Binary;
                     }
                     else if (args[i] == "--compact" || args[i] == "--protocol=compact")
                     {
-                        protocol = "compact";
-                        Console.WriteLine("Using compact protocol");
+                        protocol = ProtocolChoice.Compact;
                     }
                     else if (args[i] == "--json" || args[i] == "--protocol=json")
                     {
-                        protocol = "json";
-                        Console.WriteLine("Using JSON protocol");
+                        protocol = ProtocolChoice.Json;
                     }
                     else if (args[i] == "--ssl")
                     {
-                        encrypted = true;
-                        Console.WriteLine("Using encrypted transport");
+                        transport = TransportChoice.TlsSocket;
+                    }
+                    else if (args[i] == "--help")
+                    {
+                        PrintOptionsHelp();
+                        return;
                     }
                     else
                     {
-                        //throw new ArgumentException(args[i]);
+                        Console.WriteLine("Invalid argument: {0}", args[i]);
+                        PrintOptionsHelp();
+                        return;
                     }
                 }
+
+                switch (transport)
+                {
+                    case TransportChoice.Socket:
+                        Console.WriteLine("Using socket transport");
+                        break;
+                    case TransportChoice.TlsSocket:
+                        Console.WriteLine("Using encrypted transport");
+                        break;
+                    case TransportChoice.NamedPipe:
+                        Console.WriteLine("Using named pipes transport");
+                        break;
+                    default:  // unhandled case
+                        Debug.Assert(false);
+                        break;
+                }
+
+                switch (layered)
+                {
+                    case LayeredChoice.Framed:
+                        Console.WriteLine("Using framed transport");
+                        break;
+                    case LayeredChoice.Buffered:
+                        Console.WriteLine("Using buffered transport");
+                        break;
+                    default:  // unhandled case?
+                        Debug.Assert(layered == LayeredChoice.None);
+                        break;
+                }
+
+                switch (protocol)
+                {
+                    case ProtocolChoice.Binary:
+                        Console.WriteLine("Using binary protocol");
+                        break;
+                    case ProtocolChoice.Compact:
+                        Console.WriteLine("Using compact protocol");
+                        break;
+                    case ProtocolChoice.Json:
+                        Console.WriteLine("Using JSON protocol");
+                        break;
+                    default:  // unhandled case?
+                        Debug.Assert(false);
+                        break;
+                }
             }
 
             private static X509Certificate2 GetClientCert()
@@ -156,16 +228,15 @@
                     // endpoint transport
                     TTransport trans = null;
 
-                    if (pipe != null)
+                    switch(transport)
                     {
-                        trans = new TNamedPipeTransport(pipe);
-                    }
-                    else
-                    {
-                        if (encrypted)
-                        {
+                        case TransportChoice.NamedPipe:
+                            Debug.Assert(pipe != null);
+                            trans = new TNamedPipeTransport(pipe);
+                            break;
+
+                        case TransportChoice.TlsSocket:
                            var cert = GetClientCert();
-                        
                             if (cert == null || !cert.HasPrivateKey)
                             {
                                 throw new InvalidOperationException("Certificate doesn't contain private key");
@@ -174,22 +245,27 @@
                             trans = new TTlsSocketTransport(host, port, 0, cert, 
                                 (sender, certificate, chain, errors) => true,
                                 null, SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12);
-                        }
-                        else
-                        {
+                            break;
+
+                        case TransportChoice.Socket:
+                        default:
                             trans = new TSocketTransport(host, port);
-                        }
+                            break;
                     }
 
+
                     // layered transport
-                    if (buffered)
+                    switch(layered)
                     {
-                        trans = new TBufferedTransport(trans);
-                    }
-
-                    if (framed)
-                    {
-                        trans = new TFramedTransport(trans);
+                        case LayeredChoice.Buffered:
+                            trans = new TBufferedTransport(trans);
+                            break;
+                        case LayeredChoice.Framed:
+                            trans = new TFramedTransport(trans);
+                            break;
+                        default:
+                            Debug.Assert(layered == LayeredChoice.None);
+                            break;
                     }
 
                     return trans;
@@ -200,17 +276,16 @@
 
             public TProtocol CreateProtocol(TTransport transport)
             {
-                if (protocol == "compact")
+                switch (protocol)
                 {
-                    return new TCompactProtocol(transport);
+                    case ProtocolChoice.Compact:
+                        return new TCompactProtocol(transport);
+                    case ProtocolChoice.Json:
+                        return new TJsonProtocol(transport);
+                    case ProtocolChoice.Binary:
+                    default:
+                        return new TBinaryProtocol(transport);
                 }
-
-                if (protocol == "json")
-                {
-                    return new TJsonProtocol(transport);
-                }
-
-                return new TBinaryProtocol(transport);
             }
         }
 
