/**
  * Closes all resources consumed by the remote container client, and then stops the managed
  * container process.
  */
 @Override
 public void stop() throws LifecycleException {
   try {
     super.stop();
   } finally {
     if (!connectedToRunningServer) {
       serverControl.stopServer();
     }
   }
 }
 /**
  * Starts the managed container process, and then delegates to the remote container implementation
  * to discover additional container configuration via JMX.
  */
 @Override
 public void start() throws LifecycleException {
   serverControl = new WebLogicServerControl((CommonManagedWebLogicConfiguration) configuration);
   if (serverControl.isServerRunning()) {
     if (configuration.isAllowConnectingToRunningServer()) {
       connectedToRunningServer = true;
       super.start();
     } else {
       throw new LifecycleException(
           "The server is already running! "
               + "Managed containers does not support connecting to running server instances due to the "
               + "possible harmful effect of connecting to the wrong server. Please stop server before running or "
               + "change to another type of container.\n"
               + "To disable this check and allow Arquillian to connect to a running server, "
               + "set allowConnectingToRunningServer to true in the container configuration");
     }
   } else {
     serverControl.startServer();
     super.start();
   }
 }