From 21c33abd59a2333c48722933c6894d8ed145e638 Mon Sep 17 00:00:00 2001 From: Beat Kaeslin Date: Wed, 16 Apr 2014 16:07:58 +0200 Subject: [PATCH 1/2] Add TLS transport for C# --- lib/csharp/Makefile.am | 2 + lib/csharp/src/Thrift.csproj | 262 ++++++++--------- lib/csharp/src/Transport/TTLSServerSocket.cs | 186 ++++++++++++ lib/csharp/src/Transport/TTLSSocket.cs | 284 +++++++++++++++++++ lib/csharp/test/ThriftTest/TestClient.cs | 41 ++- lib/csharp/test/ThriftTest/TestServer.cs | 42 ++- lib/csharp/test/ThriftTest/maketest.sh | 1 + test/test.sh | 23 ++ 8 files changed, 697 insertions(+), 144 deletions(-) create mode 100644 lib/csharp/src/Transport/TTLSServerSocket.cs create mode 100644 lib/csharp/src/Transport/TTLSSocket.cs mode change 100755 => 100644 test/test.sh diff --git a/lib/csharp/Makefile.am b/lib/csharp/Makefile.am index e847237b99..b99674cb92 100644 --- a/lib/csharp/Makefile.am +++ b/lib/csharp/Makefile.am @@ -60,6 +60,8 @@ THRIFTCODE= \ src/Transport/TMemoryBuffer.cs \ src/Transport/TNamedPipeClientTransport.cs \ src/Transport/TNamedPipeServerTransport.cs \ + src/Transport/TTLSSocket.cs \ + src/Transport/TTLSServerSocket.cs \ src/TProcessor.cs \ src/TException.cs \ src/TApplicationException.cs diff --git a/lib/csharp/src/Thrift.csproj b/lib/csharp/src/Thrift.csproj index d475ed64a5..48632e29cb 100644 --- a/lib/csharp/src/Thrift.csproj +++ b/lib/csharp/src/Thrift.csproj @@ -1,4 +1,4 @@ - + - - - Debug - AnyCPU - {499EB63C-D74C-47E8-AE48-A2FC94538E9D} - 9.0.21022 - 2.0 - Library - false - Thrift - v3.5 - 512 - Thrift - - - 3.5 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - - - - - 3.5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - - - +--> + + + Debug + AnyCPU + {499EB63C-D74C-47E8-AE48-A2FC94538E9D} + 9.0.21022 + 2.0 + Library + false + Thrift + v3.5 + 512 + Thrift + + + 3.5 + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + AllRules.ruleset + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + AllRules.ruleset + + + + + 3.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + \ No newline at end of file diff --git a/lib/csharp/src/Transport/TTLSServerSocket.cs b/lib/csharp/src/Transport/TTLSServerSocket.cs new file mode 100644 index 0000000000..948b1d7c65 --- /dev/null +++ b/lib/csharp/src/Transport/TTLSServerSocket.cs @@ -0,0 +1,186 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +using System; +using System.Net.Sockets; +using System.Security.Cryptography.X509Certificates; + +namespace Thrift.Transport +{ + /// + /// SSL Server Socket Wrapper Class + /// + public class TTLSServerSocket : TServerTransport + { + /// + /// Underlying tcp server + /// + private TcpListener server = null; + + /// + /// The port where the socket listen + /// + private int port = 0; + + /// + /// Timeout for the created server socket + /// + private int clientTimeout = 0; + + /// + /// Whether or not to wrap new TSocket connections in buffers + /// + private bool useBufferedSockets = false; + + /// + /// The servercertificate with the private- and public-key + /// + private X509Certificate serverCertificate; + + + /// + /// Initializes a new instance of the class. + /// + /// The port where the server runs. + /// The certificate object. + public TTLSServerSocket(int port, X509Certificate2 certificate) + : this(port, 0, certificate) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The port where the server runs. + /// Send/receive timeout. + /// The certificate object. + public TTLSServerSocket(int port, int clientTimeout, X509Certificate2 certificate) + : this(port, clientTimeout, false, certificate) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The port where the server runs. + /// Send/receive timeout. + /// If set to true [use buffered sockets]. + /// The certificate object. + public TTLSServerSocket(int port, int clientTimeout, bool useBufferedSockets, X509Certificate2 certificate) + { + if (!certificate.HasPrivateKey) + { + throw new TTransportException(TTransportException.ExceptionType.Unknown, "Your server-certificate needs to have a private key"); + } + + this.port = port; + this.serverCertificate = certificate; + this.useBufferedSockets = useBufferedSockets; + try + { + // Create server socket + server = new TcpListener(System.Net.IPAddress.Any, this.port); + server.Server.NoDelay = true; + } + catch (Exception) + { + server = null; + throw new TTransportException("Could not create ServerSocket on port " + port + "."); + } + } + + /// + /// Starts the server. + /// + public override void Listen() + { + // Make sure accept is not blocking + if (this.server != null) + { + try + { + this.server.Start(); + } + catch (SocketException sx) + { + throw new TTransportException("Could not accept on listening socket: " + sx.Message); + } + } + } + + /// + /// Callback for Accept Implementation + /// + /// + /// TTransport-object. + /// + protected override TTransport AcceptImpl() + { + if (this.server == null) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket."); + } + + try + { + TcpClient client = this.server.AcceptTcpClient(); + client.SendTimeout = client.ReceiveTimeout = this.clientTimeout; + + //wrap the client in an SSL Socket passing in the SSL cert + TTLSSocket socket = new TTLSSocket(client, this.serverCertificate, true); + + socket.setupTLS(); + + if (useBufferedSockets) + { + TBufferedTransport trans = new TBufferedTransport(socket); + return trans; + } + else + { + return socket; + } + + } + catch (Exception ex) + { + throw new TTransportException(ex.ToString()); + } + } + + /// + /// Stops the Server + /// + public override void Close() + { + if (this.server != null) + { + try + { + this.server.Stop(); + } + catch (Exception ex) + { + throw new TTransportException("WARNING: Could not close server socket: " + ex); + } + this.server = null; + } + } + } +} diff --git a/lib/csharp/src/Transport/TTLSSocket.cs b/lib/csharp/src/Transport/TTLSSocket.cs new file mode 100644 index 0000000000..beb58760c4 --- /dev/null +++ b/lib/csharp/src/Transport/TTLSSocket.cs @@ -0,0 +1,284 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +using System; +using System.Net.Security; +using System.Net.Sockets; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; + +namespace Thrift.Transport +{ + /// + /// SSL Socket Wrapper class + /// + public class TTLSSocket : TStreamTransport + { + /// + /// Internal TCP Client + /// + private TcpClient client = null; + + /// + /// The host + /// + private string host = null; + + /// + /// The port + /// + private int port = 0; + + /// + /// The timeout for the connection + /// + private int timeout = 0; + + /// + /// Internal SSL Stream for IO + /// + private SslStream secureStream = null; + + /// + /// Defines wheter or not this socket is a server socket
+ /// This is used for the TLS-authentication + ///
+ private bool isServer = false; + + /// + /// The certificate + /// + private X509Certificate certificate = null; + + /// + /// Initializes a new instance of the class. + /// + /// An already created TCP-client + /// The certificate. + /// if set to true [is server]. + public TTLSSocket(TcpClient client, X509Certificate certificate, bool isServer = false) + { + this.client = client; + this.certificate = certificate; + this.isServer = isServer; + + if (IsOpen) + { + base.inputStream = client.GetStream(); + base.outputStream = client.GetStream(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// The host, where the socket should connect to. + /// The port. + /// The certificate path. + public TTLSSocket(string host, int port, string certificatePath) + : this(host, port, 0, X509Certificate.CreateFromCertFile(certificatePath)) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The host, where the socket should connect to. + /// The port. + /// The certificate. + public TTLSSocket(string host, int port, X509Certificate certificate) + : this(host, port, 0, certificate) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The host, where the socket should connect to. + /// The port. + /// The timeout. + /// The certificate. + public TTLSSocket(string host, int port, int timeout, X509Certificate certificate) + { + this.host = host; + this.port = port; + this.timeout = timeout; + this.certificate = certificate; + + InitSocket(); + } + + /// + /// Creates the TcpClient and sets the timeouts + /// + private void InitSocket() + { + this.client = new TcpClient(); + client.ReceiveTimeout = client.SendTimeout = timeout; + client.Client.NoDelay = true; + } + + /// + /// Sets Send / Recv Timeout for IO + /// + public int Timeout + { + set + { + this.client.ReceiveTimeout = this.client.SendTimeout = this.timeout = value; + } + } + + /// + /// Gets the TCP client. + /// + public TcpClient TcpClient + { + get + { + return client; + } + } + + /// + /// Gets the host. + /// + public string Host + { + get + { + return host; + } + } + + /// + /// Gets the port. + /// + public int Port + { + get + { + return port; + } + } + + /// + /// Gets a value indicating whether TCP Client is Cpen + /// + public override bool IsOpen + { + get + { + if (this.client == null) + { + return false; + } + + return this.client.Connected; + } + } + + /// + /// Validates the certificates!
+ ///
+ /// The sender-object. + /// The used certificate. + /// The certificate chain. + /// An enum, which lists all the errors from the .NET certificate check. + /// + private bool CertificateValidator(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslValidationErrors) + { + return (sslValidationErrors == SslPolicyErrors.None); + } + + /// + /// Connects to the host and starts the routine, which sets up the TLS + /// + public override void Open() + { + if (IsOpen) + { + throw new TTransportException(TTransportException.ExceptionType.AlreadyOpen, "Socket already connected"); + } + + if (String.IsNullOrEmpty(host)) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open null host"); + } + + if (port <= 0) + { + throw new TTransportException(TTransportException.ExceptionType.NotOpen, "Cannot open without port"); + } + + if (client == null) + { + InitSocket(); + } + + client.Connect(host, port); + + setupTLS(); + } + + /// + /// Creates a TLS-stream and lays it over the existing socket + /// + public void setupTLS() + { + if (isServer) + { + // Server authentication + this.secureStream = new SslStream(this.client.GetStream(), false); + this.secureStream.AuthenticateAsServer(this.certificate, false, SslProtocols.Tls, true); + } + else + { + // Client authentication + X509CertificateCollection validCerts = new X509CertificateCollection(); + validCerts.Add(certificate); + + this.secureStream = new SslStream(this.client.GetStream(), false, new RemoteCertificateValidationCallback(CertificateValidator)); + this.secureStream.AuthenticateAsClient(host, validCerts, SslProtocols.Tls, true); + } + + inputStream = this.secureStream; + outputStream = this.secureStream; + } + + /// + /// Closes the SSL Socket + /// + public override void Close() + { + base.Close(); + if (this.client != null) + { + this.client.Close(); + this.client = null; + } + + if (this.secureStream != null) + { + this.secureStream.Close(); + this.secureStream = null; + } + } + } +} diff --git a/lib/csharp/test/ThriftTest/TestClient.cs b/lib/csharp/test/ThriftTest/TestClient.cs index ba2d4d07e2..f619c6490b 100644 --- a/lib/csharp/test/ThriftTest/TestClient.cs +++ b/lib/csharp/test/ThriftTest/TestClient.cs @@ -30,6 +30,7 @@ namespace Test public class TestClient { private static int numIterations = 1; + private static string protocol = ""; public static void Execute(string[] args) { @@ -39,7 +40,7 @@ public static void Execute(string[] args) int port = 9090; string url = null, pipe = null; int numThreads = 1; - bool buffered = false, framed = false; + bool buffered = false, framed = false, encrypted = false; try { @@ -81,6 +82,21 @@ public static void Execute(string[] args) { numThreads = Convert.ToInt32(args[++i]); } + else if (args[i] == "-ssl") + { + encrypted = true; + Console.WriteLine("Using encrypted transport"); + } + else if (args[i] == "-compact") + { + protocol = "compact"; + Console.WriteLine("Using compact protocol"); + } + else if (args[i] == "-json") + { + protocol = "json"; + Console.WriteLine("Using JSON protocol"); + } } } catch (Exception e) @@ -88,8 +104,6 @@ public static void Execute(string[] args) Console.WriteLine(e.StackTrace); } - - //issue tests on separate threads simultaneously Thread[] threads = new Thread[numThreads]; DateTime start = DateTime.Now; @@ -101,10 +115,15 @@ public static void Execute(string[] args) { // endpoint transport TTransport trans = null; - if( pipe != null) + if (pipe != null) trans = new TNamedPipeClientTransport(pipe); else - trans = new TSocket(host, port); + { + if (encrypted) + trans = new TTLSSocket(host, port, "../../../../../keys/client.pem"); + else + trans = new TSocket(host, port); + } // layered transport if (buffered) @@ -151,9 +170,15 @@ public static void ClientThread(object obj) public static void ClientTest(TTransport transport) { - TBinaryProtocol binaryProtocol = new TBinaryProtocol(transport); - - ThriftTest.Client client = new ThriftTest.Client(binaryProtocol); + TProtocol proto; + if (protocol == "compact") + proto = new TCompactProtocol(transport); + else if (protocol == "json") + proto = new TJSONProtocol(transport); + else + proto = new TBinaryProtocol(transport); + + ThriftTest.Client client = new ThriftTest.Client(proto); try { if (!transport.IsOpen) diff --git a/lib/csharp/test/ThriftTest/TestServer.cs b/lib/csharp/test/ThriftTest/TestServer.cs index 965a7deb51..f0e9abbf7d 100644 --- a/lib/csharp/test/ThriftTest/TestServer.cs +++ b/lib/csharp/test/ThriftTest/TestServer.cs @@ -23,6 +23,7 @@ // http://developers.facebook.com/thrift/ using System; using System.Collections.Generic; +using System.Security.Cryptography.X509Certificates; using Thrift.Collections; using Thrift.Test; //generated code using Thrift.Transport; @@ -321,7 +322,7 @@ public static void Execute(string[] args) { try { - bool useBufferedSockets = false, useFramed = false; + bool useBufferedSockets = false, useFramed = false, useEncryption = false, compact = false, json = false; int port = 9090, i = 0; string pipe = null; if (args.Length > 0) @@ -343,7 +344,7 @@ public static void Execute(string[] args) { // as default } - else if ( args[i] == "buffered" ) + else if (args[i] == "buffered") { useBufferedSockets = true; } @@ -351,6 +352,18 @@ public static void Execute(string[] args) { useFramed = true; } + else if (args[i] == "ssl") + { + useEncryption = true; + } + else if (args[i] == "compact" ) + { + compact = true; + } + else if (args[i] == "json" ) + { + json = true; + } else { // Fall back to the older boolean syntax @@ -371,15 +384,30 @@ public static void Execute(string[] args) } else { - trans = new TServerSocket(port, 0, useBufferedSockets); + if (useEncryption) + { + trans = new TTLSServerSocket(port, 0, useBufferedSockets, new X509Certificate2("../../../../../keys/server.pem")); + } + else + { + trans = new TServerSocket(port, 0, useBufferedSockets); + } } + TProtocolFactory proto; + if ( compact ) + proto = new TCompactProtocol.Factory(); + else if ( json ) + proto = new TJSONProtocol.Factory(); + else + proto = new TBinaryProtocol.Factory(); + // Simple Server TServer serverEngine; if ( useFramed ) - serverEngine = new TSimpleServer(testProcessor, trans, new TFramedTransport.Factory()); + serverEngine = new TSimpleServer(testProcessor, trans, new TFramedTransport.Factory(), proto); else - serverEngine = new TSimpleServer(testProcessor, trans); + serverEngine = new TSimpleServer(testProcessor, trans, new TTransportFactory(), proto); // ThreadPool Server // serverEngine = new TThreadPoolServer(testProcessor, tServerSocket); @@ -391,9 +419,11 @@ public static void Execute(string[] args) // Run it string where = ( pipe != null ? "on pipe "+pipe : "on port " + port); - Console.WriteLine("Starting the server " +where+ + Console.WriteLine("Starting the server " + where + (useBufferedSockets ? " with buffered socket" : "") + (useFramed ? " with framed transport" : "") + + (useEncryption ? " with encryption" : "") + + (compact ? " with compact protocol" : "") + "..."); serverEngine.Serve(); diff --git a/lib/csharp/test/ThriftTest/maketest.sh b/lib/csharp/test/ThriftTest/maketest.sh index 86c1a1141f..210a52346a 100644 --- a/lib/csharp/test/ThriftTest/maketest.sh +++ b/lib/csharp/test/ThriftTest/maketest.sh @@ -26,4 +26,5 @@ gmcs /out:TestClientServer.exe /reference:../../Thrift.dll /reference:ThriftImp export MONO_PATH=../../ timeout 120 ./TestClientServer.exe server & +sleep 1 ./TestClientServer.exe client diff --git a/test/test.sh b/test/test.sh old mode 100755 new mode 100644 index dc2957164f..d2124dd7c9 --- a/test/test.sh +++ b/test/test.sh @@ -102,6 +102,28 @@ nodejs_protocols="binary json" nodejs_transports="buffered framed" nodejs_sockets="ip ip-ssl" +csharp_protocols="binary compact json" +csharp_transports="buffered framed" +csharp_sockets="ip ip-ssl" + +######### csharp client - csharp server ############# +export MONO_PATH=../lib/csharp +for proto in $csharp_protocols; do + for trans in $csharp_transports; do + for sock in $csharp_sockets; do + case "$sock" in + "ip" ) extraparam="";; + "ip-ssl" ) extraparam="--ssl";; + esac + do_test "csharp-csharp" "${proto}" "${trans}-${sock}" \ + "../lib/csharp/test/ThriftTest/TestClientServer.exe client --protocol=${proto} --transport=${trans} ${extraparam}" \ + "../lib/csharp/ ../lib/csharp/test/ThriftTest/TestClientServer.exe server --protocol=${proto} --transport=${trans} ${extraparam}" \ + "10" "10" + done + done +done + + ant -f ../lib/java/build.xml compile-test 1>/dev/null ######### java client - java server ############# @@ -209,6 +231,7 @@ done # delete Unix Domain Socket used by cpp tests rm -f /tmp/ThriftTest.thrift + do_test "py-py" "binary" "buffered-ip" \ "py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \ "py/TestServer.py --proto=binary --port=9090 --genpydir=py/gen-py TSimpleServer" \ From 60a0baa1797b0ef0ea6f8c21e5b81a78cdfcdf16 Mon Sep 17 00:00:00 2001 From: Beat Kaeslin Date: Thu, 17 Apr 2014 08:23:57 +0200 Subject: [PATCH 2/2] csharp tests moved to the end --- lib/csharp/src/Thrift.csproj | 264 +++++++++++------------ lib/csharp/test/ThriftTest/TestClient.cs | 5 +- test/test.sh | 35 ++- 3 files changed, 151 insertions(+), 153 deletions(-) diff --git a/lib/csharp/src/Thrift.csproj b/lib/csharp/src/Thrift.csproj index 48632e29cb..1f1086808d 100644 --- a/lib/csharp/src/Thrift.csproj +++ b/lib/csharp/src/Thrift.csproj @@ -1,4 +1,4 @@ - + - - - Debug - AnyCPU - {499EB63C-D74C-47E8-AE48-A2FC94538E9D} - 9.0.21022 - 2.0 - Library - false - Thrift - v3.5 - 512 - Thrift - - - 3.5 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - - - - - 3.5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - - - \ No newline at end of file +--> + + + Debug + AnyCPU + {499EB63C-D74C-47E8-AE48-A2FC94538E9D} + 9.0.21022 + 2.0 + Library + false + Thrift + v3.5 + 512 + Thrift + + + 3.5 + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + AllRules.ruleset + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + AllRules.ruleset + + + + + 3.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + diff --git a/lib/csharp/test/ThriftTest/TestClient.cs b/lib/csharp/test/ThriftTest/TestClient.cs index f619c6490b..593169f0a2 100644 --- a/lib/csharp/test/ThriftTest/TestClient.cs +++ b/lib/csharp/test/ThriftTest/TestClient.cs @@ -124,13 +124,13 @@ public static void Execute(string[] args) else trans = new TSocket(host, port); } - + // layered transport if (buffered) trans = new TBufferedTransport(trans as TStreamTransport); if (framed) trans = new TFramedTransport(trans); - + //ensure proper open/close of transport trans.Open(); trans.Close(); @@ -455,7 +455,6 @@ public static void ClientTest(TTransport transport) } Console.WriteLine("}"); - sbyte arg0 = 1; int arg1 = 2; long arg2 = long.MaxValue; diff --git a/test/test.sh b/test/test.sh index d2124dd7c9..de16fa0977 100644 --- a/test/test.sh +++ b/test/test.sh @@ -106,24 +106,6 @@ csharp_protocols="binary compact json" csharp_transports="buffered framed" csharp_sockets="ip ip-ssl" -######### csharp client - csharp server ############# -export MONO_PATH=../lib/csharp -for proto in $csharp_protocols; do - for trans in $csharp_transports; do - for sock in $csharp_sockets; do - case "$sock" in - "ip" ) extraparam="";; - "ip-ssl" ) extraparam="--ssl";; - esac - do_test "csharp-csharp" "${proto}" "${trans}-${sock}" \ - "../lib/csharp/test/ThriftTest/TestClientServer.exe client --protocol=${proto} --transport=${trans} ${extraparam}" \ - "../lib/csharp/ ../lib/csharp/test/ThriftTest/TestClientServer.exe server --protocol=${proto} --transport=${trans} ${extraparam}" \ - "10" "10" - done - done -done - - ant -f ../lib/java/build.xml compile-test 1>/dev/null ######### java client - java server ############# @@ -231,6 +213,23 @@ done # delete Unix Domain Socket used by cpp tests rm -f /tmp/ThriftTest.thrift +######### csharp client - csharp server ############# +export MONO_PATH=../lib/csharp +for proto in $csharp_protocols; do + for trans in $csharp_transports; do + for sock in $csharp_sockets; do + case "$sock" in + "ip" ) extraparam="";; + "ip-ssl" ) extraparam="--ssl";; + esac + do_test "csharp-csharp" "${proto}" "${trans}-${sock}" \ + "../lib/csharp/test/ThriftTest/TestClientServer.exe client --protocol=${proto} --transport=${trans} ${extraparam}" \ + "../lib/csharp/test/ThriftTest/TestClientServer.exe server --protocol=${proto} --transport=${trans} ${extraparam}" \ + "10" "10" + done + done +done + do_test "py-py" "binary" "buffered-ip" \ "py/TestClient.py --proto=binary --port=9090 --host=localhost --genpydir=py/gen-py" \