summaryrefslogtreecommitdiff
path: root/java/test/Ice/udp/Server.java
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2009-03-24 12:31:31 -0230
committerMatthew Newhook <matthew@zeroc.com>2009-03-24 12:31:31 -0230
commit4cc5d77c383b6c91c3af9fe44df9687bb9b15580 (patch)
tree64ce3d6cf35b15497de50f298f7225a8c72f64b6 /java/test/Ice/udp/Server.java
parentMerge commit 'origin/R3_3_branch' (diff)
downloadice-4cc5d77c383b6c91c3af9fe44df9687bb9b15580.tar.bz2
ice-4cc5d77c383b6c91c3af9fe44df9687bb9b15580.tar.xz
ice-4cc5d77c383b6c91c3af9fe44df9687bb9b15580.zip
Merged android-testsuite branch.
Diffstat (limited to 'java/test/Ice/udp/Server.java')
-rw-r--r--java/test/Ice/udp/Server.java77
1 files changed, 28 insertions, 49 deletions
diff --git a/java/test/Ice/udp/Server.java b/java/test/Ice/udp/Server.java
index bedd63218bb..9ce5a7869c8 100644
--- a/java/test/Ice/udp/Server.java
+++ b/java/test/Ice/udp/Server.java
@@ -7,74 +7,53 @@
//
// **********************************************************************
-public class Server
+package test.Ice.udp;
+
+public class Server extends test.Util.Application
{
- private static int
- run(String[] args, Ice.Communicator communicator)
+ public int run(String[] args)
{
- Ice.Properties properties = communicator.getProperties();
+ Ice.Properties properties = communicator().getProperties();
if(args.length == 1 && args[0].equals("1"))
{
properties.setProperty("TestAdapter.Endpoints", "udp -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new TestIntfI(), communicator.stringToIdentity("test"));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new TestIntfI(), communicator().stringToIdentity("test"));
adapter.activate();
}
- String host;
- if(properties.getProperty("Ice.IPv6") == "1")
- {
- host = "\"ff01::1:1\"";
- }
- else
- {
- host = "239.255.1.1";
- }
- properties.setProperty("McastTestAdapter.Endpoints", "udp -h " + host + " -p 12020");
- Ice.ObjectAdapter mcastAdapter = communicator.createObjectAdapter("McastTestAdapter");
- mcastAdapter.add(new TestIntfI(), communicator.stringToIdentity("test"));
+ Ice.ObjectAdapter mcastAdapter = communicator().createObjectAdapter("McastTestAdapter");
+ mcastAdapter.add(new TestIntfI(), communicator().stringToIdentity("test"));
mcastAdapter.activate();
- communicator.waitForShutdown();
- return 0;
+ return WAIT;
}
- public static void
- main(String[] args)
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
{
- int status = 0;
- Ice.Communicator communicator = null;
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.UDP.RcvSize", "16384");
- try
+ String host;
+ if(initData.properties.getProperty("Ice.IPv6") == "1")
{
- Ice.StringSeqHolder argHolder = new Ice.StringSeqHolder(args);
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(argHolder);
-
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.UDP.RcvSize", "16384");
-
- communicator = Ice.Util.initialize(argHolder, initData);
- status = run(argHolder.value, communicator);
+ host = "\"ff01::1:1\"";
}
- catch(Exception ex)
+ else
{
- ex.printStackTrace();
- status = 1;
+ host = "239.255.1.1";
}
+ initData.properties.setProperty("McastTestAdapter.Endpoints", "udp -h " + host + " -p 12020");
+ return initData;
+ }
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- status = 1;
- }
- }
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
System.gc();
System.exit(status);