uses "console", "rmi", "array";

object o = null, p = null, server = null;
string host = "localhost";

if( Array.size(argv) > 0 )
  host = argv[0];

RMI.debugOn = false;

o = RMI.connectToService( "::tcpip", "connect:$host:", "SomeResource" );
p = RMI.connectToService( "::tcpip", "connect:$host:", "AnotherResource" );
server = RMI.connectToService( "::tcpip", "connect:$host:", "RMIServerControl" );

if( o != null )
{
    Console.println( "Testing o" );
    Console.println( "Return from o.getValue() == '${o.getValue()}'" );
    Console.println( "o.someValue = '${o.someValue}'" );
    o.attribute_set( "someValue", "Harrow Taxi Driver" );
    Console.println( "o.someValue = '${o.someValue}'" );    
    o.someValue = "Toothy Hurty";
    Console.println( "o.someValue = '${o.someValue}'" );    
    Console.println( "Return from o.getValue() == '${o.getValue()}'" );
}
if( p != null )
{
    Console.println( "Testing p" );
    Console.println( "Return from p.getValue() == '${p.getValue()}'" );
    p.someValue = "This should change from the above value of p.getValue()";
    Console.println( "Return from p.getValue() == '${p.getValue()}'" );
}

Console.println( "Asking Server To Shutdown" );
server.shutdown();
