private static void retrieveServerMetadata() throws Exception {
        if (get() == null) {
            throw new IllegalStateException("Cannot retrieve the server metadata - no reference to Chameleon stored " +
                    "in the holder");
        }

        int factor = Integer.getInteger("time.factor", 1);
        if (factor != 1) {
            TimeUtils.TIME_FACTOR = factor;
        }

        // Before checking, ensure stability.
        ServiceReference[] references = get().waitForStability().context().getAllServiceReferences(WisdomEngine.class
                .getName(), null);

        if (references == null || references.length == 0) {
            references = get().waitForStability().context().getAllServiceReferences(WisdomEngine.class.getName(), null);
        }

        if (references == null || references.length == 0) {
            throw new IllegalStateException("Cannot retrieve the Wisdom Engine service");
        }

        Object engine = get().context().getService(references[0]);
        HOST_NAME = (String) engine.getClass().getMethod("hostname").invoke(engine);
        HTTP_PORT = (int) engine.getClass().getMethod("httpPort").invoke(engine);
        HTTPS_PORT = (int) engine.getClass().getMethod("httpsPort").invoke(engine);
    }
private static void retrieveServerMetadata ( ) throws Exception { if ( get ( ) == null ) { throw new IllegalStateException ( "Cannot retrieve the server metadata - no reference to Chameleon stored " + "in the holder" ) ; } int factor = Integer . getInteger ( "time.factor" , 1 ) ; if ( factor != 1 ) { TimeUtils . TIME_FACTOR = factor ; } ServiceReference [ ] references = get ( ) . waitForStability ( ) . context ( ) . getAllServiceReferences ( WisdomEngine . class . getName ( ) , null ) ; if ( references == null || references . length == 0 ) { references = get ( ) . waitForStability ( ) . context ( ) . getAllServiceReferences ( WisdomEngine . class . getName ( ) , null ) ; } if ( references == null || references . length == 0 ) { throw new IllegalStateException ( "Cannot retrieve the Wisdom Engine service" ) ; } Object engine = get ( ) . context ( ) . getService ( references [ 0 ] ) ; HOST_NAME = ( String ) engine . getClass ( ) . getMethod ( "hostname" ) . invoke ( engine ) ; HTTP_PORT = ( int ) engine . getClass ( ) . getMethod ( "httpPort" ) . invoke ( engine ) ; HTTPS_PORT = ( int ) engine . getClass ( ) . getMethod ( "httpsPort" ) . invoke ( engine ) ; }
Methods call by the test framework to discover the server name and port.

@throws Exception if the service is not running.