コード例 #1
0
ファイル: HttpTest.java プロジェクト: yangel-wu/ulook_sports
  @SmallTest
  public void testPost2() throws Throwable {

    httpManager.postData(
        "http://up.qiniu.com",
        "hello".getBytes(),
        null,
        null,
        new CompletionHandler() {
          @Override
          public void complete(ResponseInfo rinfo, JSONObject response) {
            Log.d("qiniutest", rinfo.toString());
            info = rinfo;
            signal.countDown();
          }
        },
        null,
        false);

    try {
      signal.await(60, TimeUnit.SECONDS); // wait for callback
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    Assert.assertNotNull(info.reqId);
  }
コード例 #2
0
ファイル: HttpTest.java プロジェクト: yangel-wu/ulook_sports
  @SmallTest
  public void testPostIP() throws Throwable {
    Header[] x = {new BasicHeader("Host", "www.qiniu.com")};
    httpManager.postData(
        "http://183.136.139.12/",
        "hello".getBytes(),
        x,
        null,
        new CompletionHandler() {
          @Override
          public void complete(ResponseInfo rinfo, JSONObject response) {
            Log.d("qiniutest", rinfo.toString());
            info = rinfo;
            signal.countDown();
          }
        },
        null,
        false);

    try {
      signal.await(60, TimeUnit.SECONDS); // wait for callback
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    Assert.assertNotNull(info.reqId);
    Assert.assertEquals(200, info.statusCode);
  }