protected void setUp()
        {
            CountdownLatch latch    = new CountdownLatch(1);
            InitListener   listener = new InitListener(latch);

            Platform.init(listener);
            latch.Wait();
            Assert.AreEqual(InitStateChangedEvent.InitState.INITIALIZED, listener.initState, "Failed to initialize the platform due to: " + listener.errMsg);
            _service   = Platform.getService();
            dispatcher = new AddLiveServiceEventDispatcher();
            _service.addServiceListener(createVoidResponder(), dispatcher);
            awaitVoidResult("addServiceListener");
        }
        // =====================================================================

        /// <summary>
        /// Releases the platform resources.
        /// </summary>
        public static void release()
        {
            /* dispose the platform */
            if (_platformHandle == IntPtr.Zero)
            {
                return;
            }
            // notify service that the platform was disposed so all dangling
            // references does not crash.
            ((CloudeoServiceImpl)_service).platformDisposed();
            NativeAPI.adl_release_platform(_platformHandle);
            _platformHandle = IntPtr.Zero;
            // release the service to deallocate it.
            _service = null;
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="ptr"></param>
 /// <param name="err"></param>
 /// <param name="h"></param>
 private static void onInitComplete(IntPtr ptr,
                                    ref ADLError err, IntPtr h)
 {
     InitStateChangedEvent.InitState state;
     if (err.err_code == 0)
     {
         _platformHandle = h;
         _service        = new CloudeoServiceImpl(h);
         state           = InitStateChangedEvent.InitState.INITIALIZED;
     }
     else
     {
         state = InitStateChangedEvent.InitState.ERROR;
     }
     if (_listener != null)
     {
         InitStateChangedEvent e = new InitStateChangedEvent(state,
                                                             err.err_code, err.err_message.body);
         _listener.onInitStateChanged(e);
     }
 }
 protected void setUp()
 {
     CountdownLatch latch = new CountdownLatch(1);
     InitListener listener = new InitListener(latch);
     Platform.init(listener);
     latch.Wait();
     Assert.AreEqual(InitStateChangedEvent.InitState.INITIALIZED, listener.initState, "Failed to initialize the platform due to: " + listener.errMsg);
     _service = Platform.getService();
     dispatcher = new AddLiveServiceEventDispatcher();
     _service.addServiceListener(createVoidResponder(), dispatcher);
     awaitVoidResult("addServiceListener");
 }
        /**
         * Constructors
         * =====================================================================
         */

        /// <summary>
        /// Static initialization. Private.
        /// </summary>
        static Platform()
        {
            _service        = null;
            _platformHandle = IntPtr.Zero;
        }