1 // Licensed to the Apache Software Foundation(ASF) under one
2 // or more contributor license agreements.See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership.The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
19 using System.Collections.Generic;
20 using System.Diagnostics;
24 using System.Reflection;
25 using System.Security.Authentication;
26 using System.Security.Cryptography.X509Certificates;
27 using System.ServiceModel;
29 using System.Threading;
30 using System.Threading.Tasks;
31 using Thrift.Collections;
32 using Thrift.Protocol;
33 using Thrift.Transport;
34 using Thrift.Transport.Client;
38 internal enum ProtocolChoice
45 // it does not make much sense to use buffered when we already use framed
46 internal enum LayeredChoice
54 internal enum TransportChoice
62 public class TestClient
64 private class TestParams
66 public int numIterations = 1;
67 public string host = "localhost";
68 public int port = 9090;
69 public int numThreads = 1;
72 public LayeredChoice layered = LayeredChoice.None;
73 public ProtocolChoice protocol = ProtocolChoice.Binary;
74 public TransportChoice transport = TransportChoice.Socket;
76 internal void Parse(List<string> args)
78 for (var i = 0; i < args.Count; ++i)
83 transport = TransportChoice.Http;
85 else if (args[i] == "-n")
87 numIterations = Convert.ToInt32(args[++i]);
89 else if (args[i].StartsWith("--pipe="))
91 pipe = args[i].Substring(args[i].IndexOf("=") + 1);
92 transport = TransportChoice.NamedPipe;
94 else if (args[i].StartsWith("--host="))
96 // check there for ipaddress
97 host = args[i].Substring(args[i].IndexOf("=") + 1);
98 if (transport != TransportChoice.TlsSocket)
99 transport = TransportChoice.Socket;
101 else if (args[i].StartsWith("--port="))
103 port = int.Parse(args[i].Substring(args[i].IndexOf("=") + 1));
104 if (transport != TransportChoice.TlsSocket)
105 transport = TransportChoice.Socket;
107 else if (args[i] == "-b" || args[i] == "--buffered" || args[i] == "--transport=buffered")
109 layered = LayeredChoice.Buffered;
111 else if (args[i] == "-f" || args[i] == "--framed" || args[i] == "--transport=framed")
113 layered = LayeredChoice.Framed;
115 else if (args[i] == "-t")
117 numThreads = Convert.ToInt32(args[++i]);
119 else if (args[i] == "--binary" || args[i] == "--protocol=binary")
121 protocol = ProtocolChoice.Binary;
123 else if (args[i] == "--compact" || args[i] == "--protocol=compact")
125 protocol = ProtocolChoice.Compact;
127 else if (args[i] == "--json" || args[i] == "--protocol=json")
129 protocol = ProtocolChoice.Json;
131 else if (args[i] == "--ssl")
133 transport = TransportChoice.TlsSocket;
135 else if (args[i] == "--help")
142 Console.WriteLine("Invalid argument: {0}", args[i]);
150 case TransportChoice.Socket:
151 Console.WriteLine("Using socket transport");
153 case TransportChoice.TlsSocket:
154 Console.WriteLine("Using encrypted transport");
156 case TransportChoice.Http:
157 Console.WriteLine("Using HTTP transport");
159 case TransportChoice.NamedPipe:
160 Console.WriteLine("Using named pipes transport");
162 default: // unhandled case
169 case LayeredChoice.Framed:
170 Console.WriteLine("Using framed transport");
172 case LayeredChoice.Buffered:
173 Console.WriteLine("Using buffered transport");
175 default: // unhandled case?
176 Debug.Assert(layered == LayeredChoice.None);
182 case ProtocolChoice.Binary:
183 Console.WriteLine("Using binary protocol");
185 case ProtocolChoice.Compact:
186 Console.WriteLine("Using compact protocol");
188 case ProtocolChoice.Json:
189 Console.WriteLine("Using JSON protocol");
191 default: // unhandled case?
197 private static X509Certificate2 GetClientCert()
199 var clientCertName = "client.p12";
200 var possiblePaths = new List<string>
208 string existingPath = null;
209 foreach (var possiblePath in possiblePaths)
211 var path = Path.GetFullPath(possiblePath + clientCertName);
212 if (File.Exists(path))
219 if (string.IsNullOrEmpty(existingPath))
221 throw new FileNotFoundException($"Cannot find file: {clientCertName}");
224 var cert = new X509Certificate2(existingPath, "thrift");
229 public TTransport CreateTransport()
231 // endpoint transport
232 TTransport trans = null;
236 case TransportChoice.Http:
237 Debug.Assert(url != null);
238 trans = new THttpTransport(new Uri(url), null);
241 case TransportChoice.NamedPipe:
242 Debug.Assert(pipe != null);
243 trans = new TNamedPipeTransport(pipe);
246 case TransportChoice.TlsSocket:
247 var cert = GetClientCert();
248 if (cert == null || !cert.HasPrivateKey)
250 throw new InvalidOperationException("Certificate doesn't contain private key");
253 trans = new TTlsSocketTransport(host, port, 0, cert,
254 (sender, certificate, chain, errors) => true,
255 null, SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12);
258 case TransportChoice.Socket:
260 trans = new TSocketTransport(host, port);
268 case LayeredChoice.Buffered:
269 trans = new TBufferedTransport(trans);
271 case LayeredChoice.Framed:
272 trans = new TFramedTransport(trans);
275 Debug.Assert(layered == LayeredChoice.None);
282 public TProtocol CreateProtocol(TTransport transport)
286 case ProtocolChoice.Compact:
287 return new TCompactProtocol(transport);
288 case ProtocolChoice.Json:
289 return new TJsonProtocol(transport);
290 case ProtocolChoice.Binary:
292 return new TBinaryProtocol(transport);
298 private const int ErrorBaseTypes = 1;
299 private const int ErrorStructs = 2;
300 private const int ErrorContainers = 4;
301 private const int ErrorExceptions = 8;
302 private const int ErrorUnknown = 64;
304 private class ClientTest
306 private readonly TTransport transport;
307 private readonly ThriftTest.Client client;
308 private readonly int numIterations;
311 public int ReturnCode { get; set; }
313 public ClientTest(TestParams param)
315 transport = param.CreateTransport();
316 client = new ThriftTest.Client(param.CreateProtocol(transport));
317 numIterations = param.numIterations;
320 public void Execute()
324 Console.WriteLine("Execute called more than once");
325 throw new InvalidOperationException();
328 for (var i = 0; i < numIterations; i++)
332 if (!transport.IsOpen)
333 transport.OpenAsync(MakeTimeoutToken()).GetAwaiter().GetResult();
335 catch (TTransportException ex)
337 Console.WriteLine("*** FAILED ***");
338 Console.WriteLine("Connect failed: " + ex.Message);
339 ReturnCode |= ErrorUnknown;
340 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
345 Console.WriteLine("*** FAILED ***");
346 Console.WriteLine("Connect failed: " + ex.Message);
347 ReturnCode |= ErrorUnknown;
348 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
354 ReturnCode |= ExecuteClientTestAsync(client).GetAwaiter().GetResult(); ;
358 Console.WriteLine("*** FAILED ***");
359 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
360 ReturnCode |= ErrorUnknown;
369 Console.WriteLine("Error while closing transport");
370 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
376 internal static void PrintOptionsHelp()
378 Console.WriteLine("Client options:");
379 Console.WriteLine(" -u <URL>");
380 Console.WriteLine(" -t <# of threads to run> default = 1");
381 Console.WriteLine(" -n <# of iterations> per thread");
382 Console.WriteLine(" --pipe=<pipe name>");
383 Console.WriteLine(" --host=<IP address>");
384 Console.WriteLine(" --port=<port number>");
385 Console.WriteLine(" --transport=<transport name> one of buffered,framed (defaults to none)");
386 Console.WriteLine(" --protocol=<protocol name> one of compact,json (defaults to binary)");
387 Console.WriteLine(" --ssl");
391 public static int Execute(List<string> args)
395 var param = new TestParams();
403 Console.WriteLine("*** FAILED ***");
404 Console.WriteLine("Error while parsing arguments");
405 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
409 var tests = Enumerable.Range(0, param.numThreads).Select(_ => new ClientTest(param)).ToArray();
411 //issue tests on separate threads simultaneously
412 var threads = tests.Select(test => new Task(test.Execute)).ToArray();
413 var start = DateTime.Now;
414 foreach (var t in threads)
419 Task.WaitAll(threads);
421 Console.WriteLine("Total time: " + (DateTime.Now - start));
423 return tests.Select(t => t.ReturnCode).Aggregate((r1, r2) => r1 | r2);
425 catch (Exception outerEx)
427 Console.WriteLine("*** FAILED ***");
428 Console.WriteLine("Unexpected error");
429 Console.WriteLine(outerEx.Message + " ST: " + outerEx.StackTrace);
434 public static string BytesToHex(byte[] data)
436 return BitConverter.ToString(data).Replace("-", string.Empty);
440 public enum BinaryTestSize
442 Empty, // Edge case: the zero-length empty binary
443 Normal, // Fairly small array of usual size (256 bytes)
444 Large, // Large writes/reads may cause range check errors
445 PipeWriteLimit, // Windows Limit: Pipe write operations across a network are limited to 65,535 bytes per write.
446 TwentyMB // that's quite a bit of data
449 public static byte[] PrepareTestData(bool randomDist, BinaryTestSize testcase)
454 case BinaryTestSize.Empty:
457 case BinaryTestSize.Normal:
460 case BinaryTestSize.Large:
461 amount = 0x8000 + 128;
463 case BinaryTestSize.PipeWriteLimit:
464 amount = 0xFFFF + 128;
466 case BinaryTestSize.TwentyMB:
467 amount = 20 * 1024 * 1024;
470 throw new ArgumentException(nameof(testcase));
473 var retval = new byte[amount];
475 // linear distribution, unless random is requested
478 for (var i = 0; i < retval.Length; ++i)
485 // random distribution
486 var rnd = new Random();
487 for (var i = 1; i < retval.Length; ++i)
489 retval[i] = (byte)rnd.Next(0x100);
494 private static CancellationToken MakeTimeoutToken(int msec = 5000)
496 var token = new CancellationTokenSource(msec);
500 public static async Task<int> ExecuteClientTestAsync(ThriftTest.Client client)
504 Console.Write("testVoid()");
505 await client.testVoidAsync(MakeTimeoutToken());
506 Console.WriteLine(" = void");
508 Console.Write("testString(\"Test\")");
509 var s = await client.testStringAsync("Test", MakeTimeoutToken());
510 Console.WriteLine(" = \"" + s + "\"");
513 Console.WriteLine("*** FAILED ***");
514 returnCode |= ErrorBaseTypes;
517 Console.Write("testBool(true)");
518 var t = await client.testBoolAsync((bool)true, MakeTimeoutToken());
519 Console.WriteLine(" = " + t);
522 Console.WriteLine("*** FAILED ***");
523 returnCode |= ErrorBaseTypes;
525 Console.Write("testBool(false)");
526 var f = await client.testBoolAsync((bool)false, MakeTimeoutToken());
527 Console.WriteLine(" = " + f);
530 Console.WriteLine("*** FAILED ***");
531 returnCode |= ErrorBaseTypes;
534 Console.Write("testByte(1)");
535 var i8 = await client.testByteAsync((sbyte)1, MakeTimeoutToken());
536 Console.WriteLine(" = " + i8);
539 Console.WriteLine("*** FAILED ***");
540 returnCode |= ErrorBaseTypes;
543 Console.Write("testI32(-1)");
544 var i32 = await client.testI32Async(-1, MakeTimeoutToken());
545 Console.WriteLine(" = " + i32);
548 Console.WriteLine("*** FAILED ***");
549 returnCode |= ErrorBaseTypes;
552 Console.Write("testI64(-34359738368)");
553 var i64 = await client.testI64Async(-34359738368, MakeTimeoutToken());
554 Console.WriteLine(" = " + i64);
555 if (-34359738368 != i64)
557 Console.WriteLine("*** FAILED ***");
558 returnCode |= ErrorBaseTypes;
561 // TODO: Validate received message
562 Console.Write("testDouble(5.325098235)");
563 var dub = await client.testDoubleAsync(5.325098235, MakeTimeoutToken());
564 Console.WriteLine(" = " + dub);
565 if (5.325098235 != dub)
567 Console.WriteLine("*** FAILED ***");
568 returnCode |= ErrorBaseTypes;
570 Console.Write("testDouble(-0.000341012439638598279)");
571 dub = await client.testDoubleAsync(-0.000341012439638598279, MakeTimeoutToken());
572 Console.WriteLine(" = " + dub);
573 if (-0.000341012439638598279 != dub)
575 Console.WriteLine("*** FAILED ***");
576 returnCode |= ErrorBaseTypes;
580 foreach(BinaryTestSize binTestCase in Enum.GetValues(typeof(BinaryTestSize)))
582 var binOut = PrepareTestData(true, binTestCase);
584 Console.Write("testBinary({0} bytes)", binOut.Length);
587 var binIn = await client.testBinaryAsync(binOut, MakeTimeoutToken());
588 Console.WriteLine(" = {0} bytes", binIn.Length);
589 if (binIn.Length != binOut.Length)
591 Console.WriteLine("*** FAILED ***");
592 returnCode |= ErrorBaseTypes;
594 for (var ofs = 0; ofs < Math.Min(binIn.Length, binOut.Length); ++ofs)
596 if (binIn[ofs] != binOut[ofs])
598 Console.WriteLine("*** FAILED ***");
599 returnCode |= ErrorBaseTypes;
603 catch (Thrift.TApplicationException ex)
605 Console.WriteLine("*** FAILED ***");
606 returnCode |= ErrorBaseTypes;
607 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
612 Console.WriteLine("Test CrazyNesting");
613 var one = new CrazyNesting();
614 var two = new CrazyNesting();
615 one.String_field = "crazy";
616 two.String_field = "crazy";
617 one.Binary_field = new byte[] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF };
618 two.Binary_field = new byte[10] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF };
619 if (typeof(CrazyNesting).GetMethod("Equals")?.DeclaringType == typeof(CrazyNesting))
621 if (!one.Equals(two))
623 Console.WriteLine("*** FAILED ***");
624 returnCode |= ErrorContainers;
625 throw new Exception("CrazyNesting.Equals failed");
629 // TODO: Validate received message
630 Console.Write("testStruct({\"Zero\", 1, -3, -5})");
631 var o = new Xtruct();
632 o.String_thing = "Zero";
633 o.Byte_thing = (sbyte)1;
636 var i = await client.testStructAsync(o, MakeTimeoutToken());
637 Console.WriteLine(" = {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}");
639 // TODO: Validate received message
640 Console.Write("testNest({1, {\"Zero\", 1, -3, -5}, 5})");
641 var o2 = new Xtruct2();
642 o2.Byte_thing = (sbyte)1;
645 var i2 = await client.testNestAsync(o2, MakeTimeoutToken());
647 Console.WriteLine(" = {" + i2.Byte_thing + ", {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}, " + i2.I32_thing + "}");
649 var mapout = new Dictionary<int, int>();
650 for (var j = 0; j < 5; j++)
654 Console.Write("testMap({");
656 foreach (var key in mapout.Keys)
666 Console.Write(key + " => " + mapout[key]);
670 var mapin = await client.testMapAsync(mapout, MakeTimeoutToken());
672 Console.Write(" = {");
674 foreach (var key in mapin.Keys)
684 Console.Write(key + " => " + mapin[key]);
686 Console.WriteLine("}");
688 // TODO: Validate received message
689 var listout = new List<int>();
690 for (var j = -2; j < 3; j++)
694 Console.Write("testList({");
696 foreach (var j in listout)
710 var listin = await client.testListAsync(listout, MakeTimeoutToken());
712 Console.Write(" = {");
714 foreach (var j in listin)
726 Console.WriteLine("}");
729 // TODO: Validate received message
730 var setout = new THashSet<int>();
731 for (var j = -2; j < 3; j++)
735 Console.Write("testSet({");
737 foreach (int j in setout)
751 var setin = await client.testSetAsync(setout, MakeTimeoutToken());
753 Console.Write(" = {");
755 foreach (int j in setin)
767 Console.WriteLine("}");
770 Console.Write("testEnum(ONE)");
771 var ret = await client.testEnumAsync(Numberz.ONE, MakeTimeoutToken());
772 Console.WriteLine(" = " + ret);
773 if (Numberz.ONE != ret)
775 Console.WriteLine("*** FAILED ***");
776 returnCode |= ErrorStructs;
779 Console.Write("testEnum(TWO)");
780 ret = await client.testEnumAsync(Numberz.TWO, MakeTimeoutToken());
781 Console.WriteLine(" = " + ret);
782 if (Numberz.TWO != ret)
784 Console.WriteLine("*** FAILED ***");
785 returnCode |= ErrorStructs;
788 Console.Write("testEnum(THREE)");
789 ret = await client.testEnumAsync(Numberz.THREE, MakeTimeoutToken());
790 Console.WriteLine(" = " + ret);
791 if (Numberz.THREE != ret)
793 Console.WriteLine("*** FAILED ***");
794 returnCode |= ErrorStructs;
797 Console.Write("testEnum(FIVE)");
798 ret = await client.testEnumAsync(Numberz.FIVE, MakeTimeoutToken());
799 Console.WriteLine(" = " + ret);
800 if (Numberz.FIVE != ret)
802 Console.WriteLine("*** FAILED ***");
803 returnCode |= ErrorStructs;
806 Console.Write("testEnum(EIGHT)");
807 ret = await client.testEnumAsync(Numberz.EIGHT, MakeTimeoutToken());
808 Console.WriteLine(" = " + ret);
809 if (Numberz.EIGHT != ret)
811 Console.WriteLine("*** FAILED ***");
812 returnCode |= ErrorStructs;
815 Console.Write("testTypedef(309858235082523)");
816 var uid = await client.testTypedefAsync(309858235082523L, MakeTimeoutToken());
817 Console.WriteLine(" = " + uid);
818 if (309858235082523L != uid)
820 Console.WriteLine("*** FAILED ***");
821 returnCode |= ErrorStructs;
824 // TODO: Validate received message
825 Console.Write("testMapMap(1)");
826 var mm = await client.testMapMapAsync(1, MakeTimeoutToken());
827 Console.Write(" = {");
828 foreach (var key in mm.Keys)
830 Console.Write(key + " => {");
832 foreach (var k2 in m2.Keys)
834 Console.Write(k2 + " => " + m2[k2] + ", ");
836 Console.Write("}, ");
838 Console.WriteLine("}");
840 // TODO: Validate received message
841 var insane = new Insanity();
842 insane.UserMap = new Dictionary<Numberz, long>();
843 insane.UserMap[Numberz.FIVE] = 5000L;
844 var truck = new Xtruct();
845 truck.String_thing = "Truck";
846 truck.Byte_thing = (sbyte)8;
849 insane.Xtructs = new List<Xtruct>();
850 insane.Xtructs.Add(truck);
851 Console.Write("testInsanity()");
852 var whoa = await client.testInsanityAsync(insane, MakeTimeoutToken());
853 Console.Write(" = {");
854 foreach (var key in whoa.Keys)
857 Console.Write(key + " => {");
859 foreach (var k2 in val.Keys)
863 Console.Write(k2 + " => {");
864 var userMap = v2.UserMap;
869 foreach (var k3 in userMap.Keys)
871 Console.Write(k3 + " => " + userMap[k3] + ", ");
876 Console.Write("null");
878 Console.Write("}, ");
880 var xtructs = v2.Xtructs;
885 foreach (var x in xtructs)
887 Console.Write("{\"" + x.String_thing + "\", " + x.Byte_thing + ", " + x.I32_thing + ", " + x.I32_thing + "}, ");
892 Console.Write("null");
896 Console.Write("}, ");
898 Console.Write("}, ");
900 Console.WriteLine("}");
904 var arg2 = long.MaxValue;
905 var multiDict = new Dictionary<short, string>();
906 multiDict[1] = "one";
908 var tmpMultiDict = new List<string>();
909 foreach (var pair in multiDict)
910 tmpMultiDict.Add(pair.Key +" => "+ pair.Value);
912 var arg4 = Numberz.FIVE;
914 Console.Write("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + ",{" + string.Join(",", tmpMultiDict) + "}," + arg4 + "," + arg5 + ")");
915 var multiResponse = await client.testMultiAsync(arg0, arg1, arg2, multiDict, arg4, arg5, MakeTimeoutToken());
916 Console.Write(" = Xtruct(byte_thing:" + multiResponse.Byte_thing + ",String_thing:" + multiResponse.String_thing
917 + ",i32_thing:" + multiResponse.I32_thing + ",i64_thing:" + multiResponse.I64_thing + ")\n");
921 Console.WriteLine("testException(\"Xception\")");
922 await client.testExceptionAsync("Xception", MakeTimeoutToken());
923 Console.WriteLine("*** FAILED ***");
924 returnCode |= ErrorExceptions;
928 if (ex.ErrorCode != 1001 || ex.Message != "Xception")
930 Console.WriteLine("*** FAILED ***");
931 returnCode |= ErrorExceptions;
936 Console.WriteLine("*** FAILED ***");
937 returnCode |= ErrorExceptions;
938 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
942 Console.WriteLine("testException(\"TException\")");
943 await client.testExceptionAsync("TException", MakeTimeoutToken());
944 Console.WriteLine("*** FAILED ***");
945 returnCode |= ErrorExceptions;
947 catch (Thrift.TException)
953 Console.WriteLine("*** FAILED ***");
954 returnCode |= ErrorExceptions;
955 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
959 Console.WriteLine("testException(\"ok\")");
960 await client.testExceptionAsync("ok", MakeTimeoutToken());
965 Console.WriteLine("*** FAILED ***");
966 returnCode |= ErrorExceptions;
967 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
972 Console.WriteLine("testMultiException(\"Xception\", ...)");
973 await client.testMultiExceptionAsync("Xception", "ignore", MakeTimeoutToken());
974 Console.WriteLine("*** FAILED ***");
975 returnCode |= ErrorExceptions;
979 if (ex.ErrorCode != 1001 || ex.Message != "This is an Xception")
981 Console.WriteLine("*** FAILED ***");
982 returnCode |= ErrorExceptions;
987 Console.WriteLine("*** FAILED ***");
988 returnCode |= ErrorExceptions;
989 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
993 Console.WriteLine("testMultiException(\"Xception2\", ...)");
994 await client.testMultiExceptionAsync("Xception2", "ignore", MakeTimeoutToken());
995 Console.WriteLine("*** FAILED ***");
996 returnCode |= ErrorExceptions;
1000 if (ex.ErrorCode != 2002 || ex.Struct_thing.String_thing != "This is an Xception2")
1002 Console.WriteLine("*** FAILED ***");
1003 returnCode |= ErrorExceptions;
1006 catch (Exception ex)
1008 Console.WriteLine("*** FAILED ***");
1009 returnCode |= ErrorExceptions;
1010 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
1014 Console.WriteLine("testMultiException(\"success\", \"OK\")");
1015 if ("OK" != (await client.testMultiExceptionAsync("success", "OK", MakeTimeoutToken())).String_thing)
1017 Console.WriteLine("*** FAILED ***");
1018 returnCode |= ErrorExceptions;
1021 catch (Exception ex)
1023 Console.WriteLine("*** FAILED ***");
1024 returnCode |= ErrorExceptions;
1025 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
1028 Console.WriteLine("Test Oneway(1)");
1029 var sw = new Stopwatch();
1031 await client.testOnewayAsync(1, MakeTimeoutToken());
1033 if (sw.ElapsedMilliseconds > 1000)
1035 Console.WriteLine("*** FAILED ***");
1036 returnCode |= ErrorBaseTypes;
1039 Console.Write("Test Calltime()");
1043 var token = MakeTimeoutToken(20000);
1044 for (var k = 0; k < times; ++k)
1045 await client.testVoidAsync(token);
1047 Console.WriteLine(" = {0} ms a testVoid() call", sw.ElapsedMilliseconds / times);