Jens Geyer | 7203424 | 2013-05-08 18:46:57 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | |
| 20 | using System; |
| 21 | using System.Collections.Generic; |
| 22 | using Thrift.Collections; |
| 23 | using Thrift.Transport; |
| 24 | using Thrift.Protocol; |
| 25 | using Thrift.Server; |
| 26 | using Thrift; |
| 27 | using Test.Multiplex; |
| 28 | |
| 29 | |
| 30 | namespace Test.Multiplex.Client |
| 31 | { |
Jens Geyer | d5436f5 | 2014-10-03 19:50:38 +0200 | [diff] [blame] | 32 | public class TestClient |
| 33 | { |
Jens Geyer | 7203424 | 2013-05-08 18:46:57 +0200 | [diff] [blame] | 34 | private void Run() |
| 35 | { |
| 36 | try |
| 37 | { |
| 38 | TTransport trans; |
| 39 | trans = new TSocket("localhost", 9090); |
| 40 | trans = new TFramedTransport(trans); |
| 41 | trans.Open(); |
| 42 | |
| 43 | TProtocol Protocol = new TBinaryProtocol(trans, true, true); |
| 44 | |
| 45 | TMultiplexedProtocol multiplex; |
| 46 | |
| 47 | multiplex = new TMultiplexedProtocol( Protocol, Constants.NAME_BENCHMARKSERVICE); |
| 48 | BenchmarkService.Iface bench = new BenchmarkService.Client( multiplex); |
| 49 | |
| 50 | multiplex = new TMultiplexedProtocol( Protocol, Constants.NAME_AGGR); |
| 51 | Aggr.Iface aggr = new Aggr.Client( multiplex); |
Jens Geyer | d5436f5 | 2014-10-03 19:50:38 +0200 | [diff] [blame] | 52 | |
Jens Geyer | 7203424 | 2013-05-08 18:46:57 +0200 | [diff] [blame] | 53 | sbyte i; |
| 54 | for( i = 1; 10 >= i; ++i) |
| 55 | { |
| 56 | aggr.addValue( bench.fibonacci(i)); |
| 57 | } |
| 58 | |
| 59 | foreach( int k in aggr.getValues()) |
| 60 | { |
| 61 | Console.Write(k.ToString()+" "); |
| 62 | Console.WriteLine(""); |
| 63 | } |
| 64 | } |
| 65 | catch( Exception e) |
| 66 | { |
| 67 | Console.WriteLine( e.Message); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | |
| 72 | public static void Execute() |
| 73 | { |
| 74 | TestClient client = new TestClient(); |
| 75 | client.Run(); |
| 76 | } |
| 77 | |
| 78 | static void Main(string[] args) |
| 79 | { |
| 80 | Execute(); |
| 81 | Console.WriteLine("done."); |
| 82 | Console.ReadLine(); |
| 83 | } |
| 84 | |
| 85 | } |
| 86 | } |
| 87 | |