Example #1
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));
  }
Example #2
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));
  }
Example #3
0
 @Test
 public void send() {
   String data = "[{\"uid\":2001,\"act\":1,\"time\":\"2014-08-23 17:17:17\"}]";
   url = "http://realidtech.sinaapp.com/if";
   long startTime = System.currentTimeMillis();
   for (int i = 0; i < 100; i++) {
     System.out.println(i);
     try {
       HttpUtil.securityPost(url, data.replace("OPEN_ID", "open_id" + i), "realid", "31415926");
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
   System.out.println("last time = " + (System.currentTimeMillis() - startTime));
 }
Example #4
0
 @Test
 public void sendLocal() {
   String data = "[{\"uid\":2001,\"act\":1,\"time\":\"2014-07-28 17:17:17\"}]";
   url = "http://127.0.0.1:8081/if";
   long startTime = System.currentTimeMillis();
   for (int i = 0; i < 10; i++) {
     System.out.println(i);
     try {
       HttpUtil.securityPost(url, data.replace("OPEN_ID", "open_id" + i), "ray", "123");
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
   System.out.println("last time = " + (System.currentTimeMillis() - startTime));
 }