title: Appium when started Programmatically, the Android Driver fails to Initialize
body: <p>I have been trying to launch the Appium Server programatically and then based on the Process output, would initialize the Android Driver and run some tests. However, everytime the Appium Server is launched from the program, the execution stalls on the initialization of the Android Driver.</p>
  
  <p>Here is my method for Starting the server:</p>
  
  <pre><code>private boolean StartServer(String strCommand)
  {
      try
      {
          rtCommand = Runtime.getRuntime();
          proc = rtCommand.exec(strCommand);
  
          BufferedReader stdInput = new BufferedReader(new 
               InputStreamReader(proc.getInputStream()));
  
          //Checking output of Appium Server Initialization
          String s = null;
          while ((s = stdInput.readLine()) != null)
          {
              System.out.println(s);
              if (s.contains("Console LogLevel: debug"));
                  return true;
          }
      }
      catch (Exception ex)
      {
          System.out.println("Error in starting Appium Server. Stack Trace below:");
          ex.printStackTrace();
          return false;
      }
      return false;
  }
  </code></pre>
  
  <p>Now, My TestNG annotation <code>@BeforeClass</code> holds the following code:</p>
  
  <pre><code>@BeforeClass
  public void setUp() throws MalformedURLException
  {
      StartServer("cmd /c \"\"C:/Program Files (x86)/nodejs/node.exe\" \"C:/Program Files (x86)/Appium/node_modules/appium/lib/server/main.js\" --address 127.0.0.1 --port 4723 --platform-name Android --platform-version 23 --automation-name Appium --log-no-color --udid 3100aeb26c6a2363\"");
  
      FrameworkDriver objFrameworkDriver = new FrameworkDriver();
  
      DesiredCapabilities capabilities = new DesiredCapabilities();
      capabilities.setCapability("deviceName", "ec5bee97");
      capabilities.setCapability("BROWSER_NAME", Android");
      capabilities.setCapability("VERSION", "5.1.1");
      capabilities.setCapability("platformName", "Android");
      capabilities.setCapability("appPackage", "com.XX.AA");
      capabilities.setCapability("appActivity", "com.XX.AA.BB");
      strProjectDir = "&lt;MyProjectLoc&gt;";
  
      try
      {
          driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
      }
      catch (Exception ex)
      {
          ex.printStackTrace();
      }
  
      System.out.println();
  }
  </code></pre>
  
  <p>The execution halted here: </p>
  
  <pre><code>driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
  </code></pre>