private boolean __doConnect() {
    XSocketContext sock = null;
    try {
      this.m_is_success = false;
      XAccount account = this.__getAccount();
      XEngineListener listener = this.m_engine_listener;
      DefaultXContext context =
          XContextFactory.Util.getFactory().createMutableContext(account, listener);
      sock = context.getSocketContext();
      EngineRunner runner = new DefaultEngineRunner(context);
      runner.run();
    } catch (Exception e) {
      // e.printStackTrace();
      System.err.println(e);
    }

    try {
      sock.getInput().close();
    } catch (Exception e) {
    }
    try {
      sock.getOutput().close();
    } catch (Exception e) {
    }
    try {
      sock.getSocket().close();
    } catch (Exception e) {
    }

    return this.m_is_success;
  }
        @Override
        public void onPhaseChanged(XContext context, XPhase phase) {

          ConnV2RunnerCallback callback = ConnV2RxRunnable.this.m_runner.getCallback();

          if (XPhase.online.equals(phase)) {

            ConnV2RxRunnable.this.m_retry_interval = min_retry_interval;
            ConnV2RxRunnable.this.m_is_success = true;

            XSocketContext sock = context.getSocketContext();

            String jid = context.getContextControllerAgent().getBindedFullJID();
            InputStream in = null;
            OutputStream out = null;
            try {
              in = sock.getInput();
              out = sock.getOutput();
            } catch (IOException e) {
              e.printStackTrace();
            }
            callback.onStatusOnline(jid, in, out);
          }
          XmppStatus status = this.phase2status(phase);
          ConnV2RxRunnable.this.__setPhase(status);
        }