Esempio n. 1
0
  @Test
  public void bind() {
    url = "http://127.0.0.1:8081/svc";
    url = "http://hrwhatjava.sinaapp.com/svc";
    url = "http://realidtech.sinaapp.com/svc";
    String data =
        " <xml>\n"
            + " <ToUserName><![CDATA[toUser]]></ToUserName>\n"
            + " <FromUserName>o0SrMtzCAWz5n7OziXgMMi8NBWm0</FromUserName> \n"
            + " <CreateTime>1348831860</CreateTime>\n"
            + " <MsgType><![CDATA[text]]></MsgType>\n"
            + " <Content><![CDATA[BDXH2001]]></Content>\n"
            + " <MsgId>1234567890123456</MsgId>\n"
            + " </xml>";

    long startTime = System.currentTimeMillis();
    for (int i = 0; i < 1; i++) {
      System.out.println(i);
      try {
        HttpUtil.post(url, data.replace("OPEN_ID", "open_id" + i).replace("$XH$", i + ""));
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    System.out.println("last time = " + (System.currentTimeMillis() - startTime));
  }
Esempio n. 2
0
  @Test
  public void clickBind() throws IOException {
    String data =
        " <xml>\n"
            + " <ToUserName><![CDATA[toUser]]></ToUserName>\n"
            + " <FromUserName>ad7dedd31bcb7844</FromUserName> \n"
            + " <CreateTime>1348831860</CreateTime>\n"
            + " <MsgType><![CDATA[event]]></MsgType>\n"
            + " <Content><![CDATA[this is a test]]></Content>\n"
            + " <MsgId>1234567890123456</MsgId>\n"
            + " <Event>CLICK</Event>\n"
            + " <EventKey>BIND</EventKey>\n"
            + " </xml>";

    long startTime = System.currentTimeMillis();
    for (int i = 0; i < 1; i++) {
      System.out.println(i);
      try {
        HttpUtil.post(url, data.replace("OPEN_ID", "open_id" + i));
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    System.out.println("last time = " + (System.currentTimeMillis() - startTime));
  }