diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-05-21 13:41:53 +0200 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-05-21 13:41:53 +0200 |
commit | c8693857ceaf837cebf63a3e2d5e73dbfbfafd26 (patch) | |
tree | a8a1c05d7c7982b2d695f5acfc1902e6638a8e5d /statserver/src/main/java/com/orbekk/stats/TestClient.java | |
parent | ffc59108e61d46aabba25ed337d72d6908b7c874 (diff) |
Add stats server.
Diffstat (limited to 'statserver/src/main/java/com/orbekk/stats/TestClient.java')
-rw-r--r-- | statserver/src/main/java/com/orbekk/stats/TestClient.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/statserver/src/main/java/com/orbekk/stats/TestClient.java b/statserver/src/main/java/com/orbekk/stats/TestClient.java new file mode 100644 index 0000000..b7fb595 --- /dev/null +++ b/statserver/src/main/java/com/orbekk/stats/TestClient.java @@ -0,0 +1,40 @@ +package com.orbekk.stats; + +import java.io.IOException; +import java.net.UnknownHostException; + +import com.google.protobuf.RpcCallback; +import com.orbekk.protobuf.Rpc; +import com.orbekk.protobuf.RpcChannel; +import com.orbekk.stats.Experiments.Empty; +import com.orbekk.stats.Experiments.Experiment1; +import com.orbekk.stats.Experiments.SimpleTiming; + +public class TestClient { + public static void main(String[] args) { + RpcChannel channel = null; + try { + RpcCallback<Empty> done = new RpcCallback<Empty>() { + @Override public void run(Empty unused) { + } + }; + channel = RpcChannel.create("localhost", Common.PORT); + Experiment1 exp1 = Experiment1Impl.newStub(channel); + Rpc rpc = new Rpc(); + rpc.setTimeout(5000); + SimpleTiming timing = SimpleTiming.newBuilder() + .setTiming(1337.0) + .setNumDevices(0) + .build(); + exp1.registerSample(rpc, timing, done); + } catch (UnknownHostException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (channel != null) { + channel.close(); + } + } + } +} |