/**
   * Open HTTP connection and send SMS
   *
   * @param SMSMessage
   * @return SMSResponse
   * @throws IOException
   * @throws SQLException
   * @throws IllegalArgumentException
   * @throws UnsupportedEncodingException
   */
  public SMSResponse push(SMSMessage oMsg)
      throws IOException, SQLException, IllegalArgumentException, UnsupportedEncodingException {

    if (DebugFile.trace) {
      DebugFile.writeln("Begin SMSPushRealidadFutura.push([SMSMessage])");
      DebugFile.incIdent();
    }

    SMSResponse oRsp;
    BufferedReader oRdr;

    String sErr, sLin, sFrm = "";
    if (oPrp.getProperty("from") != null) sFrm = "&from=" + oPrp.getProperty("from");

    String sMsisdn = oMsg.msisdnNumber();
    if (sMsisdn.startsWith("+")) sMsisdn = sMsisdn.substring(1);

    String sQry =
        sUrl
            + "username="******"&password="******"&to="
            + sMsisdn
            + "&text="
            + URLEncoder.encode(oMsg.textBody(), "ISO8859_1");

    if (DebugFile.trace) {
      DebugFile.writeln(
          "new URL("
              + sUrl
              + "username="******"&password=..."
              + sFrm
              + "&to="
              + sMsisdn
              + "&text=...)");
    }

    URL oUrl = new URL(sQry);
    HttpURLConnection oCon = (HttpURLConnection) oUrl.openConnection();
    int iStatusCode = oCon.getResponseCode();

    if (DebugFile.trace) {
      DebugFile.writeln("response code is " + String.valueOf(iStatusCode));
    }

    switch (iStatusCode) {
      case 200:
        oRdr = new BufferedReader(new InputStreamReader(oCon.getInputStream(), "UTF-8"));
        sLin = oRdr.readLine();
        while (null != sLin) {
          sLin = oRdr.readLine();
        } // wend
        oRdr.close();
        oRsp =
            new SMSResponse(
                oMsg.messageId(),
                new Date(),
                SMSResponse.ErrorCode.NONE,
                SMSResponse.StatusCode.POSITIVE_ACK,
                "");
        break;
      case 422:
        SMSResponse.ErrorCode eErr = SMSResponse.ErrorCode.UNKNOWN_ERROR;
        oRdr = new BufferedReader(new InputStreamReader(oCon.getErrorStream(), "UTF-8"));
        sErr = "";
        sLin = oRdr.readLine();
        while (null != sLin) {
          if (sLin.indexOf("número de móvil válido") > 0)
            eErr = SMSResponse.ErrorCode.INVALID_MSISDN;
          if (sLin.indexOf("es demasiado largo") > 0) eErr = SMSResponse.ErrorCode.TEXT_TOO_LONG;
          if (sLin.indexOf("Usuario o contraseña erróneos") > 0)
            eErr = SMSResponse.ErrorCode.AUTHENTICATION_FAILURE;
          sErr += sLin + "\n";
          sLin = oRdr.readLine();
        } // wend
        oRdr.close();
        oRsp =
            new SMSResponse(
                oMsg.messageId(),
                new Date(),
                eErr,
                SMSResponse.StatusCode.NEGATIVE_FAILED_DELIVERY,
                sErr);
        break;
      default:
        throw new IOException("Invalid HTTP response Code " + String.valueOf(iStatusCode));
    } // end switch

    oCon.disconnect();

    if (DebugFile.trace) {
      DebugFile.decIdent();
      DebugFile.writeln("End SMSPushRealidadFutura.push() : " + oRsp.toString());
    }

    return oRsp;
  } // push