diff --git a/test/netstd/Client/TestClient.cs b/test/netstd/Client/TestClient.cs
index ddc36ac..6be1023 100644
--- a/test/netstd/Client/TestClient.cs
+++ b/test/netstd/Client/TestClient.cs
@@ -55,6 +55,7 @@
     {
         Socket,
         TlsSocket,
+        Http,
         NamedPipe
     }
 
@@ -79,6 +80,7 @@
                     if (args[i] == "-u")
                     {
                         url = args[++i];
+                        transport = TransportChoice.Http;
                     }
                     else if (args[i] == "-n")
                     {
@@ -151,6 +153,9 @@
                     case TransportChoice.TlsSocket:
                         Console.WriteLine("Using encrypted transport");
                         break;
+                    case TransportChoice.Http:
+                        Console.WriteLine("Using HTTP transport");
+                        break;
                     case TransportChoice.NamedPipe:
                         Console.WriteLine("Using named pipes transport");
                         break;
@@ -223,55 +228,55 @@
             
             public TTransport CreateTransport()
             {
-                if (url == null)
+                // endpoint transport
+                TTransport trans = null;
+
+                switch(transport)
                 {
-                    // endpoint transport
-                    TTransport trans = null;
+                    case TransportChoice.Http:
+                        Debug.Assert(url != null);
+                        trans = new THttpTransport(new Uri(url), null);
+                        break;
 
-                    switch(transport)
-                    {
-                        case TransportChoice.NamedPipe:
-                            Debug.Assert(pipe != null);
-                            trans = new TNamedPipeTransport(pipe);
-                            break;
+                    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");
-                            }
+                    case TransportChoice.TlsSocket:
+                        var cert = GetClientCert();
+                        if (cert == null || !cert.HasPrivateKey)
+                        {
+                            throw new InvalidOperationException("Certificate doesn't contain private key");
+                        }
                             
-                            trans = new TTlsSocketTransport(host, port, 0, cert, 
-                                (sender, certificate, chain, errors) => true,
-                                null, SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12);
-                            break;
+                        trans = new TTlsSocketTransport(host, port, 0, cert, 
+                            (sender, certificate, chain, errors) => true,
+                            null, SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12);
+                        break;
 
-                        case TransportChoice.Socket:
-                        default:
-                            trans = new TSocketTransport(host, port);
-                            break;
-                    }
-
-
-                    // layered transport
-                    switch(layered)
-                    {
-                        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;
+                    case TransportChoice.Socket:
+                    default:
+                        trans = new TSocketTransport(host, port);
+                        break;
                 }
 
-                return new THttpTransport(new Uri(url), null);
+
+                // layered transport
+                switch(layered)
+                {
+                    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;
             }
 
             public TProtocol CreateProtocol(TTransport transport)
