| // This file automatically generated by: |
| // Apache Etch 1.1.0-incubating (LOCAL-0) / csharp 1.1.0-incubating (LOCAL-0) |
| // Mon Feb 16 11:13:50 CST 2009 |
| // This file is automatically created for your convenience and will not be |
| // overwritten once it exists! Please edit this file as necessary to implement |
| // your service logic. |
| |
| using System; |
| using Org.Apache.Etch.Bindings.Csharp.Util; |
| |
| namespace org.apache.etch.interoptester.example.iot |
| { |
| ///<summary>Main implementation for IOTClient.</summary> |
| public class MainIOTClient : IOTHelper.IOTClientFactory |
| { |
| ///<summary>Main for IOTClient</summary> |
| ///<param name="args">Command Line Arguments</param> |
| public static void Main(String[] args) |
| { |
| if (args.Length > 1) |
| { |
| Console.WriteLine("usage: MainIOTClient [uri]"); |
| return; |
| } |
| |
| string uri = args.Length > 0 ? args[0] : "tcp://localhost:4001"; |
| |
| RemoteIOTServer server = IOTHelper.NewServer( uri, null, new MainIOTClient()); |
| |
| // Connect to the service |
| server._StartAndWaitUp( 4000 ); |
| |
| Assertion.Check(server.add(2, 3) == 5, "server.add(2, 3) == 5"); |
| |
| try |
| { |
| server.add(null, 3); |
| Assertion.Check(false, "false"); |
| } |
| catch |
| { |
| // ignore. |
| } |
| |
| try |
| { |
| server.add(2, null); |
| Assertion.Check(false, "false"); |
| } |
| catch |
| { |
| // ignore. |
| } |
| |
| try |
| { |
| server.add(null, null); |
| Assertion.Check(false, "false"); |
| } |
| catch |
| { |
| // ignore. |
| } |
| |
| // Disconnect from the service |
| server._StopAndWaitDown( 4000 ); |
| Console.WriteLine("done"); |
| } |
| |
| ///<summary>Return a new instance of IOTClient.</summary> |
| ///<param name="server">Reference to remote service</param> |
| ///<returns>Client Implementation</returns> |
| public IOTClient NewIOTClient( RemoteIOTServer server ) |
| { |
| return new ImplIOTClient( server ); |
| } |
| } |
| } |