Unirest in Java: Simplified, lightweight HTTP client library.

Overview

Unirest for Java

Actions Status MIT License Maven Central Javadocs Twitter Follow

Install With Maven:

<!-- Pull in as a traditional dependency -->
<dependency>
    <groupId>com.konghq</groupId>
    <artifactId>unirest-java</artifactId>
    <version>3.11.09</version>
</dependency>

<!-- OR as a snazzy new standalone jar with shaded dependencies -->
<dependency>
    <groupId>com.konghq</groupId>
    <artifactId>unirest-java</artifactId>
    <version>3.11.09</version>
    <classifier>standalone</classifier>
</dependency>

Upgrading from Previous Versions

See the Upgrade Guide

ChangeLog

See the Change Log for recent changes.

Documentation

Our Documentation

Comments
  • How can I create multiple instances of Unirest?

    How can I create multiple instances of Unirest?

    Hi, is there any chance that I can create multiple instances of unirest object? I would like to have multiple unirest objects with different configuration (timeouts, default headers, ...) in the application. I think this is not possible now. Is there any chance to have it in the future or is there some workaround?

    Unirest seems like great library, but I can't use it because I have many different scenarios with different configuration in application and I don't want they interfere each other.

    Thanks for the response in advance :)

    V2 Supported 
    opened by miso-belica 24
  • Support GET with a param which has multiple values

    Support GET with a param which has multiple values

    So than we can GET like this:

    Unirest.get("http://httpbin.org/get").fields(new HashMap<String, Object>() {
                {
                    this.put("name", Arrays.asList(0, 1, 2));
                }
            }).asJson();
    
    opened by qiuxiafei 23
  • Replace org.json JSON library

    Replace org.json JSON library

    I have a rather unusual request. Unireset-java uses the org.json JSON library, which is considered non-free software by some parties such as Debian or Google (https://wiki.debian.org/qa.debian.org/jsonevil). Thus, the library cannot be used in Debian, Ubuntu, Android. As a consequence, unireset-java cannot be packaged, too.

    Is it possible to replace the library by json-simple or by a cleanroom reimplementation of org.json (available under com.android.json in debian)?

    Feature Request Unirest 4 
    opened by koppor 22
  • Merge OpenUnirest/unirest-java into Kong/unirest-java

    Merge OpenUnirest/unirest-java into Kong/unirest-java

    This is a issue for the merge.

    Some prework to do:

    • [x] Change copyright/license headers to Kong
    • [x] Move Namespace back to Kong
    • [x] Figure out releasing
    • [x] Modularize the repo and move the official object mappers into it. All official mappers will relaese lock-step with unirest-java
    • [x] Remove deprecated methods
    • [x] Hide remaining places where Apache Http Client leaks out
    • [x] Add a Apache module as the default

    I'll take care of most of this in the Kong branch https://github.com/OpenUnirest/unirest-java/tree/kong

    OpenUnirest will continue to get security patched for 1 year after the merge and then will be archived.

    opened by ryber 17
  • Disable SSL Certificate check

    Disable SSL Certificate check

    Hello,

    I'm writing a server on Spring and I'm using Spring Security to limit connections to HTTPS, running the WAR on Tomcat. The server auto-generates a self-signed certificate and as I am using it in a development environment, I don't want to go through the hassle of obtaining proper certificates or something. This means that Unirest (or rather the underlying HTTP client) rejects the certificate with the following exception:

    javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    

    It's a pretty frustrating situation to be in, as I genuinely believe many people are using Unirest with these certificates. I think I can circumvent this issue by creating a custom HttpClient object and giving it to Unirest as the default, but I'd rather not mess with Unirest, in order to avoid any future issues down the line.

    I've noticed that the PHP version got this option (Mashape/unirest-php#27) quite some time ago.

    My questions are:

    1. Am I missing something obvious that would let me disable SSL certificate check? If so, would you kindly point me in the direction?
    2. If not, are there any plans to introduce this setting to the Java version as well?

    Thanks in advance for your time.

    opened by aemreunal 17
  • Get Body as String after mapping to Object

    Get Body as String after mapping to Object

    Hi

    Would be nice to add a second method (ex getRawBody() ) in HttpResponse interface returning the original response String Body even if we use .asObject() method for mapping.

    Thanks for reviewing this option

    opened by wildfiregt 15
  • Unable to find CloseableHttpClient

    Unable to find CloseableHttpClient

    I've gone about this several different ways now, and I'm running into roadblocks at each point. Here's the code that calls unirest:

    package com.akqa.glass.recipie;
    
    import android.util.Log;
    
    import com.mashape.unirest.http.HttpResponse;
    import com.mashape.unirest.http.JsonNode;
    import com.mashape.unirest.http.Unirest;
    import com.mashape.unirest.http.exceptions.UnirestException;
    
    import org.json.JSONException;
    import org.json.JSONObject;
    
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    
    //import org.apache.http.HttpResponse;
    //import org.shaded.apache.http.HttpHeaders;
    
    public class JSONParser {
        static InputStream is = null;
        static JSONObject jObj = null;
        static String json = "";
        private static final String TAG = JSONParser.class.getSimpleName();
        // constructor
        public JSONParser() {
        }
        public JSONObject getCamFindJSON(String type, String input) {
            Log.d("PARSER", "Inside Parser");
            /*
             *  Request processing from API
             */
            if(type == "request"){
                try {
                    HttpResponse<JsonNode> response = Unirest.post("https://camfind.p.mashape.com/image_requests")
                    .header("X-Mashape-Key", "Fhn5jZi5ixmshwnJMy7CGyj5yDCnp15DTQZjsniuwpVHfYHvFJ")
                    .field("image_request[image]", new File(input))
                    .field("image_request[language]", "en")
                    .field("image_request[locale]", "en_US")
                    .asJson();
                } catch (UnirestException e) {
                    Log.d(TAG, "Couldn't get request");
                    e.printStackTrace();
                }
            }
            /*
             *  Receive response from API
             */
            else if(type == "response"){
                try {
                    HttpResponse<JsonNode> response = Unirest.get("https://camfind.p.mashape.com/image_responses/" + input)
                    .header("X-Mashape-Key", "Fhn5jZi5ixmshwnJMy7CGyj5yDCnp15DTQZjsniuwpVHfYHvFJ")
                    .asJson();
                } catch (UnirestException e) {
                    Log.d(TAG, "Couldn't get reponse");
                    e.printStackTrace();
                }
            }
            /*
             *  Parse Response into readable JSON
             */
            try {
                BufferedReader reader = new BufferedReader(new InputStreamReader(
                        is, "iso-8859-1"), 8);
                StringBuilder sb = new StringBuilder();
                String line = null;
                while ((line = reader.readLine()) != null) {
                    sb.append(line + "n");
                    Log.d("Raw Data", line);
                }
                is.close();
                json = sb.toString();
            } catch (Exception e) {
                Log.e("Buffer Error", "Error converting result " + e.toString());
            }
            // try parse the string to a JSON object
            try {
                jObj = new JSONObject(json);
            } catch (JSONException e) {
                Log.e("JSON Parser", "Error parsing data " + e.toString());
                e.printStackTrace();
            } catch (Exception e) {
                Log.e("JSON Parse", "Unknown Error");
                e.printStackTrace();
            }
            // return JSON String
            return jObj;
        }
    }
    

    Here is the logcat output:

    11-24 16:26:57.473  12605-12856/com.akqa.glass.recipie E/dalvikvm﹕ Could not find class 'org.apache.http.impl.client.CloseableHttpClient', referenced from method com.mashape.unirest.http.Unirest.shutdown
    11-24 16:26:57.473  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ VFY: unable to resolve check-cast 453 (Lorg/apache/http/impl/client/CloseableHttpClient;) in Lcom/mashape/unirest/http/Unirest;
    11-24 16:26:57.473  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ VFY: replacing opcode 0x1f at 0x0006
    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie I/dalvikvm﹕ Could not find method org.apache.http.client.methods.HttpRequestBase.releaseConnection, referenced from method com.mashape.unirest.http.HttpClientHelper.request
    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ VFY: unable to resolve virtual method 1085: Lorg/apache/http/client/methods/HttpRequestBase;.releaseConnection ()V
    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0012
    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie I/dalvikvm﹕ Could not find method org.apache.http.client.methods.HttpRequestBase.releaseConnection, referenced from method com.mashape.unirest.http.HttpClientHelper.request
    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ VFY: unable to resolve virtual method 1085: Lorg/apache/http/client/methods/HttpRequestBase;.releaseConnection ()V
    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0021
    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie I/dalvikvm﹕ Could not find method org.apache.http.client.config.RequestConfig.custom, referenced from method com.mashape.unirest.http.options.Options.refresh
    11-24 16:26:57.489  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ VFY: unable to resolve static method 1059: Lorg/apache/http/client/config/RequestConfig;.custom ()Lorg/apache/http/client/config/RequestConfig$Builder;
    11-24 16:26:57.489  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0020
    11-24 16:26:57.489  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ DexOpt: unable to opt direct call 0x0701 at 0x49 in Lcom/mashape/unirest/http/options/Options;.refresh
    11-24 16:26:57.489  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/mashape/unirest/http/options/Options;
    11-24 16:26:57.489  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ threadid=11: thread exiting with uncaught exception (group=0x416aabd8)
    11-24 16:26:57.496  12605-12856/com.akqa.glass.recipie E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
        Process: com.akqa.glass.recipie, PID: 12605
        java.lang.RuntimeException: An error occured while executing doInBackground()
                at android.os.AsyncTask$3.done(AsyncTask.java:314)
                at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
                at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
                at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:240)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                at java.lang.Thread.run(Thread.java:841)
         Caused by: java.lang.NoClassDefFoundError: org.apache.http.client.config.RequestConfig
                at com.mashape.unirest.http.options.Options.refresh(Options.java:45)
                at com.mashape.unirest.http.options.Options.<clinit>(Options.java:34)
                at com.mashape.unirest.http.HttpClientHelper.prepareRequest(HttpClientHelper.java:154)
                at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:131)
                at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68)
                at com.akqa.glass.recipie.JSONParser.getCamFindJSON(JSONParser.java:41)
                at com.akqa.glass.recipie.RecipIE$CamFindRequest.doInBackground(RecipIE.java:287)
                at com.akqa.glass.recipie.RecipIE$CamFindRequest.doInBackground(RecipIE.java:275)
                at android.os.AsyncTask$2.call(AsyncTask.java:302)
                at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:240)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                at java.lang.Thread.run(Thread.java:841)
    11-24 16:26:57.520  12605-12860/com.akqa.glass.recipie D/PARSER﹕ Inside Parser
    11-24 16:26:57.520  12605-12860/com.akqa.glass.recipie I/dalvikvm﹕ Rejecting re-init on previously-failed class Lcom/mashape/unirest/http/options/Options; v=0x0
    11-24 16:26:57.528  12605-12860/com.akqa.glass.recipie W/dalvikvm﹕ threadid=13: thread exiting with uncaught exception (group=0x416aabd8)
    11-24 16:26:57.528  12605-12860/com.akqa.glass.recipie I/Process﹕ Sending signal. PID: 12605 SIG: 9
    
    opened by tortilaman 14
  • Multiple Proxies

    Multiple Proxies

    Hi there,

    There doesn't seem to be a way to have multiple proxies, I've tried to use multiple configs and then switch but doesn't seem to be what I'm looking for.

    Thanks

    opened by heychazza 13
  • mvn clean assembly:assembly can't complete

    mvn clean assembly:assembly can't complete

    I originally tried compiling with dependencies using maven in windows and got the following errors:

    <?xml version="1.0" encoding="UTF-8" ?>
    <testsuite tests="25" failures="4" name="com.mashape.unirest.test.http.UnirestTest" time="20.095" errors="0" skipped="0">
      <properties>
        <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
        <property name="sun.boot.library.path" value="C:\Program Files\Java\jdk1.8.0_25\jre\bin"/>
        <property name="java.vm.version" value="25.25-b02"/>
        <property name="java.vm.vendor" value="Oracle Corporation"/>
        <property name="java.vendor.url" value="http://java.oracle.com/"/>
        <property name="path.separator" value=";"/>
        <property name="guice.disable.misplaced.annotation.check" value="true"/>
        <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/>
        <property name="file.encoding.pkg" value="sun.io"/>
        <property name="user.script" value=""/>
        <property name="user.country" value="US"/>
        <property name="sun.java.launcher" value="SUN_STANDARD"/>
        <property name="sun.os.patch.level" value=""/>
        <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
        <property name="user.dir" value="C:\Users\torti_000\unirest-java"/>
        <property name="java.runtime.version" value="1.8.0_25-b18"/>
        <property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment"/>
        <property name="java.endorsed.dirs" value="C:\Program Files\Java\jdk1.8.0_25\jre\lib\endorsed"/>
        <property name="os.arch" value="amd64"/>
        <property name="java.io.tmpdir" value="C:\Users\TORTI_~1\AppData\Local\Temp\"/>
        <property name="line.separator" value="
    "/>
        <property name="java.vm.specification.vendor" value="Oracle Corporation"/>
        <property name="user.variant" value=""/>
        <property name="os.name" value="Windows 8.1"/>
        <property name="classworlds.conf" value="C:\Program Files\Apache\apache-maven-3.2.3\bin\m2.conf"/>
        <property name="sun.jnu.encoding" value="Cp1252"/>
        <property name="java.library.path" value="C:\Program Files\Java\jdk1.8.0_25\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Git\cmd;C:\Users\torti_000\Desktop\adb-tools;C:\Program Files\Java\jdk1.8.0_25\bin;C:\Program Files\Apache\apache-maven-3.2.3\bin;C:\Program Files (x86)\Atmel\Flip 3.4.7\bin;."/>
        <property name="java.specification.name" value="Java Platform API Specification"/>
        <property name="java.class.version" value="52.0"/>
        <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
        <property name="os.version" value="6.3"/>
        <property name="user.home" value="C:\Users\torti_000"/>
        <property name="user.timezone" value="America/Los_Angeles"/>
        <property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob"/>
        <property name="java.specification.version" value="1.8"/>
        <property name="file.encoding" value="Cp1252"/>
        <property name="user.name" value="torti_000"/>
        <property name="java.class.path" value="C:\Program Files\Apache\apache-maven-3.2.3\boot\plexus-classworlds-2.5.1.jar"/>
        <property name="java.vm.specification.version" value="1.8"/>
        <property name="sun.arch.data.model" value="64"/>
        <property name="java.home" value="C:\Program Files\Java\jdk1.8.0_25\jre"/>
        <property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher clean assembly:assembly"/>
        <property name="java.specification.vendor" value="Oracle Corporation"/>
        <property name="user.language" value="en"/>
        <property name="awt.toolkit" value="sun.awt.windows.WToolkit"/>
        <property name="java.vm.info" value="mixed mode"/>
        <property name="java.version" value="1.8.0_25"/>
        <property name="java.ext.dirs" value="C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext;C:\Windows\Sun\Java\lib\ext"/>
        <property name="sun.boot.class.path" value="C:\Program Files\Java\jdk1.8.0_25\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_25\jre\classes"/>
        <property name="sun.stderr.encoding" value="cp437"/>
        <property name="java.vendor" value="Oracle Corporation"/>
        <property name="maven.home" value="C:\Program Files\Apache\apache-maven-3.2.3"/>
        <property name="file.separator" value="\"/>
        <property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/"/>
        <property name="sun.cpu.endian" value="little"/>
        <property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
        <property name="sun.stdout.encoding" value="cp437"/>
        <property name="sun.desktop" value="windows"/>
        <property name="sun.cpu.isalist" value="amd64"/>
      </properties>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testGet" time="1.057"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testCustomUserAgent" time="0.117"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testAsync" time="0.267"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testGzip" time="0.128"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testPathParameters2" time="0.108"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testBasicAuth" time="0.134"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testGzipAsync" time="0.1"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testSetTimeouts" time="3.383"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testGetFields2" time="0.185"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testMultipart" time="0.14">
        <failure message="expected:&lt;This [
    is 
    a 
    test ]
    file&gt; but was:&lt;This [
    is 
    a 
    test 
    ]
    file&gt;" type="org.junit.ComparisonFailure">org.junit.ComparisonFailure: expected:&lt;This [
    is 
    a 
    test ]
    file&gt; but was:&lt;This [
    is 
    a 
    test 
    ]
    file&gt;
        at org.junit.Assert.assertEquals(Assert.java:115)
        at org.junit.Assert.assertEquals(Assert.java:144)
        at com.mashape.unirest.test.http.UnirestTest.testMultipart(UnirestTest.java:279)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
    </failure>
      </testcase>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testGetUTF8" time="0.097"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testAsyncCallback" time="0.198"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testRequests" time="0.271"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testQueryAndBodyParameters" time="0.139"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testPostBinaryUTF8" time="0.11">
        <failure message="expected:&lt;This [
    is 
    a 
    test ]
    file&gt; but was:&lt;This [
    is 
    a 
    test 
    ]
    file&gt;" type="org.junit.ComparisonFailure">org.junit.ComparisonFailure: expected:&lt;This [
    is 
    a 
    test ]
    file&gt; but was:&lt;This [
    is 
    a 
    test 
    ]
    file&gt;
        at org.junit.Assert.assertEquals(Assert.java:115)
        at org.junit.Assert.assertEquals(Assert.java:144)
        at com.mashape.unirest.test.http.UnirestTest.testPostBinaryUTF8(UnirestTest.java:129)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
    </failure>
      </testcase>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testPostRawBody" time="0.117">
        <failure message="expected:&lt;&apos;&quot;@[こんにちは]-test-123-0.65075844...&gt; but was:&lt;&apos;&quot;@[?????]-test-123-0.65075844...&gt;" type="org.junit.ComparisonFailure">org.junit.ComparisonFailure: expected:&lt;&apos;&quot;@[こんにちは]-test-123-0.65075844...&gt; but was:&lt;&apos;&quot;@[?????]-test-123-0.65075844...&gt;
        at org.junit.Assert.assertEquals(Assert.java:115)
        at org.junit.Assert.assertEquals(Assert.java:144)
        at com.mashape.unirest.test.http.UnirestTest.testPostRawBody(UnirestTest.java:142)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
    </failure>
      </testcase>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testDeleteBody" time="0.117"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testMissingPathParameter" time="0"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testGetFields" time="0.222"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testDelete" time="0.237"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testPostUTF8" time="0.106"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testDefaultHeaders" time="0.348"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testMultipartAsync" time="10.007">
        <failure type="java.lang.AssertionError">java.lang.AssertionError
        at org.junit.Assert.fail(Assert.java:86)
        at org.junit.Assert.assertTrue(Assert.java:41)
        at org.junit.Assert.assertTrue(Assert.java:52)
        at com.mashape.unirest.test.http.UnirestTest.testMultipartAsync(UnirestTest.java:320)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
    </failure>
        <system-err>Exception in thread &quot;I/O dispatcher 5&quot; org.junit.ComparisonFailure: expected:&lt;This [
    is 
    a 
    test ]
    file&gt; but was:&lt;This [
    is 
    a 
    test 
    ]
    file&gt;
        at org.junit.Assert.assertEquals(Assert.java:115)
        at org.junit.Assert.assertEquals(Assert.java:144)
        at com.mashape.unirest.test.http.UnirestTest$2.completed(UnirestTest.java:306)
        at com.mashape.unirest.http.HttpClientHelper$1.completed(HttpClientHelper.java:82)
        at com.mashape.unirest.http.HttpClientHelper$1.completed(HttpClientHelper.java:75)
        at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:115)
        at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:173)
        at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:355)
        at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:242)
        at org.apache.http.impl.nio.client.LoggingAsyncRequestExecutor.inputReady(LoggingAsyncRequestExecutor.java:87)
        at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:264)
        at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:73)
        at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:37)
        at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:113)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:159)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:338)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:316)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:277)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:105)
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:584)
        at java.lang.Thread.run(Thread.java:745)
    </system-err>
      </testcase>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testPathParameters" time="0.107"/>
      <testcase classname="com.mashape.unirest.test.http.UnirestTest" name="testGetMultiple" time="2.4"/>
    </testsuite>
    

    Next I eventually got maven working on mac and tried doing it there. Still errors:

    <?xml version="1.0" encoding="UTF-8" ?>
    <testsuite failures="1" time="6.307" errors="0" skipped="0" tests="25" name="com.mashape.unirest.test.http.UnirestTest">
      <properties>
        <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
        <property name="sun.boot.library.path" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries"/>
        <property name="java.vm.version" value="20.65-b04-466.1"/>
        <property name="awt.nativeDoubleBuffering" value="true"/>
        <property name="gopherProxySet" value="false"/>
        <property name="mrj.build" value="11M4716"/>
        <property name="java.vm.vendor" value="Apple Inc."/>
        <property name="java.vendor.url" value="http://www.apple.com/"/>
        <property name="path.separator" value=":"/>
        <property name="guice.disable.misplaced.annotation.check" value="true"/>
        <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/>
        <property name="file.encoding.pkg" value="sun.io"/>
        <property name="user.country" value="US"/>
        <property name="sun.java.launcher" value="SUN_STANDARD"/>
        <property name="sun.os.patch.level" value="unknown"/>
        <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
        <property name="user.dir" value="/Users/nick.doering/unirest-java"/>
        <property name="java.runtime.version" value="1.6.0_65-b14-466.1-11M4716"/>
        <property name="java.awt.graphicsenv" value="apple.awt.CGraphicsEnvironment"/>
        <property name="java.endorsed.dirs" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/endorsed"/>
        <property name="os.arch" value="x86_64"/>
        <property name="java.io.tmpdir" value="/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/"/>
        <property name="line.separator" value="
    "/>
        <property name="java.vm.specification.vendor" value="Sun Microsystems Inc."/>
        <property name="os.name" value="Mac OS X"/>
        <property name="classworlds.conf" value="/usr/local/apache-maven/bin/m2.conf"/>
        <property name="sun.jnu.encoding" value="MacRoman"/>
        <property name="java.library.path" value=".:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java"/>
        <property name="java.specification.name" value="Java Platform API Specification"/>
        <property name="java.class.version" value="50.0"/>
        <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
        <property name="os.version" value="10.9.4"/>
        <property name="http.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
        <property name="user.home" value="/var/root"/>
        <property name="user.timezone" value="America/Los_Angeles"/>
        <property name="java.awt.printerjob" value="apple.awt.CPrinterJob"/>
        <property name="java.specification.version" value="1.6"/>
        <property name="file.encoding" value="MacRoman"/>
        <property name="user.name" value="root"/>
        <property name="java.class.path" value="/usr/local/apache-maven/boot/plexus-classworlds-2.5.1.jar"/>
        <property name="java.vm.specification.version" value="1.0"/>
        <property name="sun.arch.data.model" value="64"/>
        <property name="java.home" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"/>
        <property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher clean assembly:assembly"/>
        <property name="java.specification.vendor" value="Sun Microsystems Inc."/>
        <property name="user.language" value="en"/>
        <property name="awt.toolkit" value="apple.awt.CToolkit"/>
        <property name="java.vm.info" value="mixed mode"/>
        <property name="java.version" value="1.6.0_65"/>
        <property name="java.ext.dirs" value="/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext"/>
        <property name="sun.boot.class.path" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsfd.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Resources/Java/JavaRuntimeSupport.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/laf.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/sunrsasign.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar"/>
        <property name="java.vendor" value="Apple Inc."/>
        <property name="maven.home" value="/usr/local/apache-maven"/>
        <property name="file.separator" value="/"/>
        <property name="java.vendor.url.bug" value="http://bugreport.apple.com/"/>
        <property name="sun.cpu.endian" value="little"/>
        <property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
        <property name="mrj.version" value="1070.1.6.0_65-466.1"/>
        <property name="socksNonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
        <property name="ftp.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
        <property name="sun.cpu.isalist" value=""/>
      </properties>
      <testcase time="0.95" classname="com.mashape.unirest.test.http.UnirestTest" name="testGet"/>
      <testcase time="0.151" classname="com.mashape.unirest.test.http.UnirestTest" name="testCustomUserAgent"/>
      <testcase time="0.241" classname="com.mashape.unirest.test.http.UnirestTest" name="testAsync"/>
      <testcase time="0.103" classname="com.mashape.unirest.test.http.UnirestTest" name="testGzip"/>
      <testcase time="0.15" classname="com.mashape.unirest.test.http.UnirestTest" name="testPathParameters2"/>
      <testcase time="0.092" classname="com.mashape.unirest.test.http.UnirestTest" name="testBasicAuth"/>
      <testcase time="0.1" classname="com.mashape.unirest.test.http.UnirestTest" name="testGzipAsync"/>
      <testcase time="1.024" classname="com.mashape.unirest.test.http.UnirestTest" name="testSetTimeouts"/>
      <testcase time="0.182" classname="com.mashape.unirest.test.http.UnirestTest" name="testGetFields2"/>
      <testcase time="0.096" classname="com.mashape.unirest.test.http.UnirestTest" name="testMultipart"/>
      <testcase time="0.085" classname="com.mashape.unirest.test.http.UnirestTest" name="testGetUTF8"/>
      <testcase time="0.176" classname="com.mashape.unirest.test.http.UnirestTest" name="testAsyncCallback"/>
      <testcase time="0.087" classname="com.mashape.unirest.test.http.UnirestTest" name="testRequests"/>
      <testcase time="0.094" classname="com.mashape.unirest.test.http.UnirestTest" name="testQueryAndBodyParameters"/>
      <testcase time="0.089" classname="com.mashape.unirest.test.http.UnirestTest" name="testPostBinaryUTF8"/>
      <testcase time="0.093" classname="com.mashape.unirest.test.http.UnirestTest" name="testPostRawBody">
        <failure message="expected:&lt;&apos;&quot;@[こんにちは]-test-123-0.61520199...&gt; but was:&lt;&apos;&quot;@[?????]-test-123-0.61520199...&gt;" type="org.junit.ComparisonFailure">org.junit.ComparisonFailure: expected:&lt;&apos;&quot;@[こんにちは]-test-123-0.61520199...&gt; but was:&lt;&apos;&quot;@[?????]-test-123-0.61520199...&gt;
        at org.junit.Assert.assertEquals(Assert.java:115)
        at org.junit.Assert.assertEquals(Assert.java:144)
        at com.mashape.unirest.test.http.UnirestTest.testPostRawBody(UnirestTest.java:142)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
    </failure>
      </testcase>
      <testcase time="0.086" classname="com.mashape.unirest.test.http.UnirestTest" name="testDeleteBody"/>
      <testcase time="0" classname="com.mashape.unirest.test.http.UnirestTest" name="testMissingPathParameter"/>
      <testcase time="0.087" classname="com.mashape.unirest.test.http.UnirestTest" name="testGetFields"/>
      <testcase time="0.176" classname="com.mashape.unirest.test.http.UnirestTest" name="testDelete"/>
      <testcase time="0.086" classname="com.mashape.unirest.test.http.UnirestTest" name="testPostUTF8"/>
      <testcase time="0.256" classname="com.mashape.unirest.test.http.UnirestTest" name="testDefaultHeaders"/>
      <testcase time="0.09" classname="com.mashape.unirest.test.http.UnirestTest" name="testMultipartAsync"/>
      <testcase time="0.085" classname="com.mashape.unirest.test.http.UnirestTest" name="testPathParameters"/>
      <testcase time="1.728" classname="com.mashape.unirest.test.http.UnirestTest" name="testGetMultiple"/>
    </testsuite>
    
    opened by tortilaman 13
  • Consider adding a progress listener for Callback

    Consider adding a progress listener for Callback

    One thing that would make this library even better is to add a simple progress callback that updates as a request is made. For POST/PUT/PATCH etc it would be great for this to monitor upload progress, and for GET/DELETE etc it would be great for download progress. Thoughts? This is another side note, but it would be nice to include a default callback class that provides stubbed implementations of the callback interface for those who don't wish to provide functionality for some of the methods.

    Future<HttpResponse<JsonNode>> future = Unirest.post("http://httpbin.org/post")
      .header("accept", "application/json")
      .field("param1", "value1")
      .field("param2", "value2")
      .asJsonAsync(new Callback<JsonNode>() {
    
        public void failed(UnirestException e) {
            System.out.println("The request has failed");
        }
    
        public void completed(HttpResponse<JsonNode> response) {
             int code = response.getCode();
             Map<String, String> headers = response.getHeaders();
             JsonNode body = response.getBody();
             InputStream rawBody = response.getRawBody();
        }
    
        public void cancelled() {
            System.out.println("The request has been cancelled");
        }
    
        public void progress(long current, long total) {
            System.out.println("Progress: " + ((float)current / (float)total));
        }
    
    });
    
    opened by vincentjames501 13
  • IllegalThreadStateException in HttpClientHelper.requestAsync (HttpClientHelper.java:100)

    IllegalThreadStateException in HttpClientHelper.requestAsync (HttpClientHelper.java:100)

    We're getting this error when calling requestAsync parallel during performance testing our application with gatling.

    java.lang.IllegalThreadStateException: null at java.lang.Thread.start(Thread.java:705) ~[na:1.8.0_40] at com.mashape.unirest.http.HttpClientHelper.requestAsync(HttpClientHelper.java:100) ~[unirest-java-1.4.5.jar:na] at com.mashape.unirest.request.BaseRequest.asStringAsync(BaseRequest.java:64) ~[unirest-java-1.4.5.jar:na]

    opened by jokraehe 12
  • MockServer is not found

    MockServer is not found

    I was trying to mock the unirest request:

    @Test
    public void POST_AuthUser_201() throws Exception {
            when(Unirest.get(MockServer.GET)).thenReturn(getRequest);
            ...
    }
    

    However I can't import MockServer. I have tried serveral maven imports in pom.xml including:

                     <dependency>
    			<groupId>com.konghq</groupId>
    			<artifactId>unirest-java</artifactId>
    			<version>3.14.1</version>
    			<classifier>standalone</classifier>
    		</dependency>
    		<dependency>
    			<groupId>com.konghq</groupId>
    			<artifactId>unirest-bdd-tests</artifactId>
    			<version>3.14.1</version>
    			<scope>import</scope>
    		</dependency>
    		<dependency>
    			<groupId>com.konghq</groupId>
    			<artifactId>unirest-mocks</artifactId>
    			<version>3.11.09</version>
    			<scope>test</scope>
    		</dependency>
    

    and I can't import MockServer from any of them. Tried two different IDEs as well (Eclipse and IntelliJ).

    Based on the examples I have found online and in the docs, one of these imports should be working.

    opened by mehiatt 1
  • Warning/error on invalid/non-ASCII characters in URL

    Warning/error on invalid/non-ASCII characters in URL

    Is your feature request related to a problem? Please describe. We use Unirest in our application, and recently I encountered an issue that was very hard to troubleshoot. We configure a UnirestInstance with a default base URL, and then call individual endpoints on this base URL using calls like unirestInstance.get("/api/...") and unirestInstance.post("/api/...").

    All pretty standard, however for one of these invocations we ran into a java.net.UnknownHostException, even though that request was using the same default base URL as some of the other requests, and copying/pasting the host name shown in the exception message into an nslookup command didn't reveal any issues.

    Even a breakpoint on InetAddress::getAllByName seemed to show the exact same hostname for both successful requests and the failing request. Only after doing a host.getBytes() and comparing byte contents, I noticed that the failing host name had 3 extra bytes at the end: -30 -128 -117

    From a Unirest perspective, these 3 bytes didn't come from the default base URL (as that would have caused other requests to fail as well), but from the endpoint passed in one of the get/post methods. This endpoint URI was likely copied/pasted from a Swagger page, and apparently this resulted in these 3 invisible bytes being present at the start of the endpoint URI. Being before the first slash, apparently these 3 bytes were appended to the host name, eventually causing the UnknownHostException.

    Describe the solution you'd like Not sure whether Unirest should simply reject URL's containing invalid/non-ASCII characters (which I guess could break some existing applications; maybe have this configurable and disabled by default), log a warning, ...?

    Also, I guess Unirest shouldn't have appended those 3 bytes to the host name; these 3 bytes should have been considered part of the path.

    Describe alternatives you've considered None

    Additional context N/A

    opened by rsenden 1
  • Unirest 3.7.02 Proxy Connection Timeout (Apache https://issues.apache.org/jira/browse/HTTPCLIENT-1478)

    Unirest 3.7.02 Proxy Connection Timeout (Apache https://issues.apache.org/jira/browse/HTTPCLIENT-1478)

    Describe the bug Using a bad proxy with unirest seems to disregard the timeout set. I've seen it occur multiple times where after passing the proxy to the instance configuration, it hangs on a request regardless of the timeouts (connection and socket) set via config.

    To Reproduce Code to reproduce the behavior:

    	Proxy proxy = new Proxy("127.0.0.1", 8080);
    	UnirestInstance unirest = Unirest.spawnInstance();
    	if (proxy != null) {
    		unirest.config().proxy(proxy);
    	}
    	unirest.config()
    			.verifySsl(false)
    			.followRedirects(true)
    			.enableCookieManagement(true)
    			.connectTimeout(Main.timeoutMilliseconds)
    			.socketTimeout(Main.timeoutMilliseconds);
    
    	HttpResponse<String> first = unirest.get("https://google.com/").asString();
    

    Expected behavior It will just hang on this response and produce nothing/no errors.

    Environmental Data:

    • Java Version: JDK.18.0_31
    Dependency Bug 
    opened by LandyLane 4
  • ObjectMappers should be able to take InputStreams to handle large responses

    ObjectMappers should be able to take InputStreams to handle large responses

    Is your feature request related to a problem? Please describe. Large responses must be fully read into memory in order to get passed to an ObjectMapper as a string. allow support for Mappers to take a InputStream.

    Describe the solution you'd like an overload of methods to take/return inputstreams. This should be optional and not a breaking change

    Feature Request 
    opened by ryber 0
  • Support PACT testing recording

    Support PACT testing recording

    Is your feature request related to a problem? Please describe. I'd like to be able to record interactions with Unirest and output them into a PACT file for testing. Would also be great to validate responses.

    Describe the solution you'd like Some kind of flag to begin recording a request.

    Describe alternatives you've considered The current PACT java framework has a LOT of undesirable dependencies. Need something lightweight

    Feature Request 
    opened by ryber 0
  • Support honoring Retry-After headers for 429, 503 and 301 in Async Methods

    Support honoring Retry-After headers for 429, 503 and 301 in Async Methods

    Is your feature request related to a problem? Please describe. Support honoring Retry-After headers for 429, 503 and 301

    Describe the solution you'd like When a server issues a 429, 503 or 301 with a Retry-After header the client is asked to wait that period (either a date, or a number of seconds). Enable Unirest to do this automatically

    #Questions to consider:

    • do we roll this out as default behavior or make users enable it?
    • do we have a max number of times to retry before giving up? (do it 3 times and then give up if we are still getting the header)
    • do we have a max time before giving up? (if the server tells us to wait until 2023?)
    Feature Request Unirest 4 
    opened by ryber 1
Releases(v4.0.0-RC7)
  • v4.0.0-RC7(Dec 4, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.14.1(Dec 4, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v4.0.0-RC6(Nov 26, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.14.0(Nov 26, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v4.0.0-RC5(Nov 21, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.13(Nov 21, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.12(Oct 26, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.11(Aug 23, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.10(May 24, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.9(May 24, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.8(Apr 12, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.7(Mar 16, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v4.0.0-RC4(Feb 12, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v4.0.0-RC3(Feb 12, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v4.0.0-RC2(Jan 16, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.6(Jan 6, 2022)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.5(Dec 14, 2021)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.4(Nov 20, 2021)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.3(Nov 1, 2021)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.2(Oct 23, 2021)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.1(Oct 22, 2021)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.13.0(Sep 12, 2021)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.12.0(Sep 8, 2021)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.11.13(Aug 27, 2021)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.11.12(Jul 14, 2021)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.11.11(Feb 6, 2021)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v4.0.0-RC1(Jan 18, 2021)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.11.10(Jan 9, 2021)

    See CHANGELOG.md for details. Fresh releases may take up to 20 minutes to show up in Maven Central: https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • v3.11.09(Dec 30, 2020)

    See CHANGELOG.md for details.

    Fresh releases may take up to 20 minutes to show up in Maven Central:

    https://mvnrepository.com/artifact/com.konghq/unirest-java

    Source code(tar.gz)
    Source code(zip)
  • unirest-java-1.4.8(Feb 4, 2016)

Owner
Kong
The Cloud Connectivity Company. Community Driven & Enterprise Adopted.
Kong
LiteHttp is a simple, intelligent and flexible HTTP framework for Android. With LiteHttp you can make HTTP request with only one line of code! It could convert a java model to the parameter and rander the response JSON as a java model intelligently.

Android network framework: LiteHttp Tags : litehttp2.x-tutorials Website : http://litesuits.com QQgroup : 42960650 , 47357508 Android网络通信为啥子选 lite-htt

马天宇 829 Dec 29, 2022
Asynchronous Http and WebSocket Client library for Java

Async Http Client Follow @AsyncHttpClient on Twitter. The AsyncHttpClient (AHC) library allows Java applications to easily execute HTTP requests and a

AsyncHttpClient 6k Jan 8, 2023
Android Easy Http - Simplest android http request library.

Android Easy Http Library 繁體中文文檔 About Android Easy Http Library Made on OkHttp. Easy to do http request, just make request and listen for the respons

null 13 Sep 30, 2022
:satellite: [Android Library] Simplified async networking in android

Android library that simplifies networking in android via an async http client. Also featured in [Awesome Android Newsletter #Issue 15 ] Built with ❤︎

Nishant Srivastava 36 May 14, 2022
Asynchronous socket, http(s) (client+server) and websocket library for android. Based on nio, not threads.

AndroidAsync AndroidAsync is a low level network protocol library. If you are looking for an easy to use, higher level, Android aware, http request li

Koushik Dutta 7.3k Jan 2, 2023
Java HTTP Request Library

Http Request A simple convenience library for using a HttpURLConnection to make requests and access the response. This library is available under the

Kevin Sawicki 3.3k Jan 6, 2023
Square’s meticulous HTTP client for the JVM, Android, and GraalVM.

OkHttp See the project website for documentation and APIs. HTTP is the way modern applications network. It’s how we exchange data & media. Doing HTTP

Square 43.4k Jan 5, 2023
A type-safe HTTP client for Android and the JVM

Retrofit A type-safe HTTP client for Android and Java. For more information please see the website. Download Download the latest JAR or grab from Mave

Square 41k Jan 5, 2023
Multiplatform coroutine-based HTTP client wrapper for Kotlin

networkinkt This is a lightweight HTTP client for Kotlin. It relies on coroutines on both JS & JVM platforms. Here is a simple GET request: val text =

Egor Zhdan 31 Jul 27, 2022
Kotlin DSL http client

Introduction Kotlin DSL http client Features ?? Developers Experience-driven library without verbosity. ?? Native way to use http client in Kotlin. ??

Sergei Rybalkin 461 Dec 13, 2022
An android asynchronous http client built on top of HttpURLConnection.

Versions 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 Version 1.0.6 Description An android asynchronous http client based on HttpURLConnection. Updates U

David 15 Mar 29, 2020
Ktorfit - a HTTP client/Kotlin Symbol Processor for Kotlin Multiplatform (Js, Jvm, Android, iOS, Linux) using KSP and Ktor clients inspired by Retrofit

Ktorfit is a HTTP client/Kotlin Symbol Processor for Kotlin Multiplatform (Js, Jvm, Android, iOS, Linux) using KSP and Ktor clients inspired by Retrofit

Jens Klingenberg 637 Dec 25, 2022
Kotlin-echo-client - Echo client using Kotlin with Ktor networking library

Overview This repository contains an echo server implemented with Kotlin and kto

Elliot Barlas 2 Sep 1, 2022
🚀 A Complete Fast Android Networking Library that also supports HTTP/2 🚀

Fast Android Networking Library About Fast Android Networking Library Fast Android Networking Library is a powerful library for doing any type of netw

AMIT SHEKHAR 5.5k Dec 27, 2022
HttpMocker is a simple HTTP mocking library written in Kotlin to quickly and easily handle offline modes in your apps

HttpMocker HttpMocker is a very lightweight Kotlin library that allows to mock HTTP calls relying on either OkHttp or the Ktor client libraries. It ca

David Blanc 174 Nov 28, 2022
Kotlin HTTP requests library. Similar to Python requests.

khttp khttp is a simple library for HTTP requests in Kotlin. It functions similarly to Python's requests module. import khttp.get fun main(args: Arra

Anna Clemens 466 Dec 20, 2022
The easiest HTTP networking library for Kotlin/Android

Fuel The easiest HTTP networking library for Kotlin/Android. You are looking at the documentation for 2.x.y.. If you are looking for the documentation

Kittinun Vantasin 4.3k Jan 8, 2023
super simple library to manage http requests.

HttpAgent super simple library to manage http requests. Gradle dependencies { implementation 'com.studioidan.httpagent:httpagent:1.0.16@aar' } No

idan ben shimon 32 Oct 24, 2021
🚀 A Complete Fast Android Networking Library that also supports HTTP/2 🚀

Fast Android Networking Library About Fast Android Networking Library Fast Android Networking Library is a powerful library for doing any type of netw

AMIT SHEKHAR 5.5k Jan 3, 2023