java - Making asynchronous requests using Unirest returns ZipException: Not in GZIP format -


i want make asynchronous requests server using unirest.

this test code:

public void uniresttest() throws interruptedexception, executionexception {         unirest.get("https://jsonplaceholder.typicode.com/posts/1")                 .header(content_type, application_json.tostring())                 .asjsonasync(new callback<jsonnode>() {                                  public void failed(unirestexception e) {                                      e.printstacktrace();                                  }                                   public void completed(httpresponse<jsonnode> response) {                                      system.out.println("ok");                                  }                                   public void cancelled() {                                      system.out.println("request has been canceled.");                                  }                              }                 ).get();     } 

this in console:

connected target vm, address: '127.0.0.1:64120', transport: 'socket' 02:09:15.263 [main] debug org.apache.http.impl.nio.client.mainclientexec - [exchange: 1] start execution 02:09:15.294 [main] debug org.apache.http.client.protocol.requestaddcookies - cookiespec selected: default 02:09:15.341 [main] debug org.apache.http.client.protocol.requestauthcache - auth cache not set in context 02:09:15.341 [main] debug org.apache.http.impl.nio.client.internalhttpasyncclient - [exchange: 1] request connection {s}->https://jsonplaceholder.typicode.com:443 02:09:15.356 [main] debug org.apache.http.impl.nio.conn.poolingnhttpclientconnectionmanager - connection request: [route: {s}->https://jsonplaceholder.typicode.com:443][total kept alive: 0; route allocated: 0 of 20; total allocated: 0 of 200] 02:09:16.394 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.poolingnhttpclientconnectionmanager - connection leased: [id: http-outgoing-0][route: {s}->https://jsonplaceholder.typicode.com:443][total kept alive: 0; route allocated: 1 of 20; total allocated: 1 of 200] 02:09:16.394 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.internalhttpasyncclient - [exchange: 1] connection allocated: cpoolproxy{http-outgoing-0 [active]} 02:09:16.394 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][r:]: set attribute http.nio.exchange-handler 02:09:16.394 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][rw:]: event set [w] 02:09:16.394 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][rw:]: set timeout 0 02:09:16.394 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.internaliodispatch - http-outgoing-0 [active]: connected 02:09:16.394 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][rw:]: set attribute http.nio.http-exchange-state 02:09:16.394 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.internalhttpasyncclient - start connection routing 02:09:16.552 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 upgrade session 192.168.189.147:64147<->104.31.86.157:443[active][rw:][active][rw][need_unwrap][0][0][235][0] 02:09:16.553 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.mainclientexec - connection route established 02:09:16.553 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.mainclientexec - [exchange: 1] attempt 1 execute request 02:09:16.553 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.mainclientexec - target auth state: unchallenged 02:09:16.554 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.mainclientexec - proxy auth state: unchallenged 02:09:16.554 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][rw:][active][rw][need_unwrap][0][0][235][0]: set timeout 60000 02:09:16.554 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 >> /posts/1 http/1.1 02:09:16.554 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 >> accept-encoding: gzip 02:09:16.555 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 >> content-type: application/json; charset=utf-8 02:09:16.555 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 >> user-agent: unirest-java/1.3.11 02:09:16.555 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 >> host: jsonplaceholder.typicode.com 02:09:16.555 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 >> connection: keep-alive 02:09:16.556 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][rw:][active][rw][need_unwrap][0][0][235][0]: event set [w] 02:09:16.556 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.mainclientexec - [exchange: 1] request completed 02:09:16.659 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][rw:w][active][rw][not_handshaking][0][0][217][0]: 188 bytes written 02:09:16.659 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 >> "get /posts/1 http/1.1[\r][\n]" 02:09:16.659 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 >> "accept-encoding: gzip[\r][\n]" 02:09:16.659 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 >> "content-type: application/json; charset=utf-8[\r][\n]" 02:09:16.659 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 >> "user-agent: unirest-java/1.3.11[\r][\n]" 02:09:16.659 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 >> "host: jsonplaceholder.typicode.com[\r][\n]" 02:09:16.659 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 >> "connection: keep-alive[\r][\n]" 02:09:16.659 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 >> "[\r][\n]" 02:09:16.660 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.internaliodispatch - http-outgoing-0 [active] request ready 02:09:16.660 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][r:w][active][r][not_handshaking][0][0][0][0]: event cleared [w] 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][r:r][active][r][not_handshaking][0][0][0][0]: 887 bytes read 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "http/1.1 200 ok[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "date: thu, 06 apr 2017 00:09:07 gmt[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "content-type: application/json; charset=utf-8[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "transfer-encoding: chunked[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "connection: keep-alive[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "set-cookie: __cfduid=dfa98af248364fb21c08736140224a1321491437347; expires=fri, 06-apr-18 00:09:07 gmt; path=/; domain=.typicode.com; httponly[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "x-powered-by: express[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "vary: accept-encoding[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "access-control-allow-credentials: true[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "cache-control: public, max-age=14400[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "pragma: no-cache[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "expires: thu, 06 apr 2017 04:09:07 gmt[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "x-content-type-options: nosniff[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "etag: w/"124-yikdlzqo5gfbrjfrcdj8yq0lgnu"[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "via: 1.1 vegur[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "cf-cache-status: hit[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "server: cloudflare-nginx[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "cf-ray: 34b0843afbaf15dd-fra[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "content-encoding: gzip[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "ca[\r][\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "[0x1f][0xffffff8b][0x8][0x0][0x0][0x0][0x0][0x0][0x0][0x3]u[0xffffff8f]kj[0x4]a[0xc]c[0xfffffff7]s[\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "q[0xffffffeb]l[0xffffffb2][0xffffff9d][0x1b][0xffffffe4][0xe][0xffffffbd]q\[\n]" 02:09:16.716 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "c[0xffffffe8][0xfffffffa][0xffffff8c][0xffffffcb][0x1e]&[0xffffff84][0xffffffdc]=tc[0x8][0x1]#$[0xffffff90][0x1f][0xffffffe8][0xffffffeb][0x2][0xffffff94]\[0xfffffff4][0xffffffb7]z[0xffffffae]x}9[0xffffffa2][0xfffffffd][0xffffffd9][0xffffffb0][0xffffffd8]y[0xffffffae](+{@2[0xfffffff0]!j'[0xffffff9c][0xffffff93][0xfffffffb].[0xffffff81][0xffffffe9][0xffffffe3]a[0xffffff95]=0t[0xffffff85]*a[0xffffffe0]s9#[0xffffffdd]0f[0xffffffd8]8[0xffffffca][0xffffffce][0x1b]{[0xffffffa5][[0xffffff94][0x13][0xfffffffc]>[0xffffffea][0xffffffe7][0xffffffc1][0xffffffbd][0xffffffa7][0x9][0x18]x[0xffffffb9][0xffffffd4][0xffffffa6][0xffffffc5][0xffffffd6][0x1d][0xffffff9c][0xffffff9a]kz[0x15]bg_[0xffffffbc]g[0xfffffff6]h[0x7][0xffffff9f][0xffffff93][0xffffffd5][0xffffffe2]|[0xffffffd3]l[[0xffffffff][0xffffff87]g[0x1b];w[0xffffff98][0x10][0x19][0xffffffc7][0xffffffdd]s[0x16]b[0xffffff84][0xffffffb4][0xffffffad][0xfffffff7][0xffffffb1][0xffffffc2][0xffffffb3][0xffffffc1]y([0xffffffd7]9[0xffffff89][\r][0xffffffe7]:g[0x3][0x1f][0xffffffec][0xffffffc6][0xffffff80][0xffffffb8][0xffffffde],[0xffffffa8]1[0xffffffca][0xffffffe5][0xfffffffb][0x7][0x15][0xffffffc6][0xffffff93][0xffffffe8]$[0x1][0x0][0x0][\r][\n]" 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "0[\r][\n]" 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.wire - http-outgoing-0 << "[\r][\n]" 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << http/1.1 200 ok 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << date: thu, 06 apr 2017 00:09:07 gmt 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << content-type: application/json; charset=utf-8 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << transfer-encoding: chunked 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << connection: keep-alive 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << set-cookie: __cfduid=dfa98af248364fb21c08736140224a1321491437347; expires=fri, 06-apr-18 00:09:07 gmt; path=/; domain=.typicode.com; httponly 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << x-powered-by: express 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << vary: accept-encoding 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << access-control-allow-credentials: true 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << cache-control: public, max-age=14400 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << pragma: no-cache 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << expires: thu, 06 apr 2017 04:09:07 gmt 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << x-content-type-options: nosniff 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << etag: w/"124-yikdlzqo5gfbrjfrcdj8yq0lgnu" 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << via: 1.1 vegur 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << cf-cache-status: hit 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << server: cloudflare-nginx 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << cf-ray: 34b0843afbaf15dd-fra 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.headers - http-outgoing-0 << content-encoding: gzip 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.internaliodispatch - http-outgoing-0 [active(213)] response received 02:09:16.731 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.mainclientexec - [exchange: 1] response received http/1.1 200 ok 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.client.protocol.responseprocesscookies - cookie accepted [__cfduid="dfa98af248364fb21c08736140224a1321491437347", version:0, domain:typicode.com, path:/, expiry:fri apr 06 02:09:07 cest 2018] 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.internaliodispatch - http-outgoing-0 [active(213)] input ready 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.mainclientexec - [exchange: 1] consume content 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][r:r][active][r][not_handshaking][0][0][0][0]: 0 bytes read 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][r:r][active][r][not_handshaking][0][0][0][0]: 0 bytes read 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][r:r][active][r][not_handshaking][0][0][0][0]: 0 bytes read 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.internalhttpasyncclient - [exchange: 1] connection can kept alive indefinitely 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.mainclientexec - [exchange: 1] response processed 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.internalhttpasyncclient - [exchange: 1] releasing connection 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][r:r][active][r][not_handshaking][0][0][0][0]: remove attribute http.nio.exchange-handler 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.poolingnhttpclientconnectionmanager - releasing connection: [id: http-outgoing-0][route: {s}->https://jsonplaceholder.typicode.com:443][total kept alive: 0; route allocated: 1 of 20; total allocated: 1 of 200] 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.poolingnhttpclientconnectionmanager - connection [id: http-outgoing-0][route: {s}->https://jsonplaceholder.typicode.com:443] can kept alive indefinitely 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][r:r][active][r][not_handshaking][0][0][0][0]: set timeout 0 02:09:16.809 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.poolingnhttpclientconnectionmanager - connection released: [id: http-outgoing-0][route: {s}->https://jsonplaceholder.typicode.com:443][total kept alive: 1; route allocated: 1 of 20; total allocated: 1 of 200] 02:09:20.463 [thread-1] debug org.apache.http.impl.nio.conn.poolingnhttpclientconnectionmanager - closing expired connections 02:09:20.478 [thread-0] debug org.apache.http.impl.conn.poolinghttpclientconnectionmanager - closing expired connections 02:09:22.092 [thread-1] debug org.apache.http.impl.nio.conn.poolingnhttpclientconnectionmanager - closing connections idle longer 30 seconds 02:09:22.092 [thread-0] debug org.apache.http.impl.conn.poolinghttpclientconnectionmanager - closing connections idle longer 30 seconds 02:09:22.092 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.internaliodispatch - http-outgoing-0 [active] exception java.lang.runtimeexception: java.lang.runtimeexception: java.util.zip.zipexception: not in gzip format     @ com.mashape.unirest.http.httpresponse.<init>(httpresponse.java:106)     @ com.mashape.unirest.http.httpclienthelper$1.completed(httpclienthelper.java:82)     @ com.mashape.unirest.http.httpclienthelper$1.completed(httpclienthelper.java:75)     @ org.apache.http.concurrent.basicfuture.completed(basicfuture.java:119)     @ org.apache.http.impl.nio.client.defaultclientexchangehandlerimpl.responsecompleted(defaultclientexchangehandlerimpl.java:177)     @ org.apache.http.nio.protocol.httpasyncrequestexecutor.processresponse(httpasyncrequestexecutor.java:436)     @ org.apache.http.nio.protocol.httpasyncrequestexecutor.inputready(httpasyncrequestexecutor.java:326)     @ org.apache.http.impl.nio.client.internalrequestexecutor.inputready(internalrequestexecutor.java:83)     @ org.apache.http.impl.nio.defaultnhttpclientconnection.consumeinput(defaultnhttpclientconnection.java:265)     @ org.apache.http.impl.nio.client.internaliodispatch.oninputready(internaliodispatch.java:81)     @ org.apache.http.impl.nio.client.internaliodispatch.oninputready(internaliodispatch.java:39)     @ org.apache.http.impl.nio.reactor.abstractiodispatch.inputready(abstractiodispatch.java:121)     @ org.apache.http.impl.nio.reactor.baseioreactor.readable(baseioreactor.java:162)     @ org.apache.http.impl.nio.reactor.abstractioreactor.processevent(abstractioreactor.java:337)     @ org.apache.http.impl.nio.reactor.abstractioreactor.processevents(abstractioreactor.java:315)     @ org.apache.http.impl.nio.reactor.abstractioreactor.execute(abstractioreactor.java:276)     @ org.apache.http.impl.nio.reactor.baseioreactor.execute(baseioreactor.java:104)     @ org.apache.http.impl.nio.reactor.abstractmultiworkerioreactor$worker.run(abstractmultiworkerioreactor.java:588)     @ java.lang.thread.run(thread.java:745) caused by: java.lang.runtimeexception: java.util.zip.zipexception: not in gzip format     @ com.mashape.unirest.http.httpresponse.<init>(httpresponse.java:89)     ... 18 common frames omitted caused by: java.util.zip.zipexception: not in gzip format     @ java.util.zip.gzipinputstream.readheader(gzipinputstream.java:165)     @ java.util.zip.gzipinputstream.<init>(gzipinputstream.java:79)     @ java.util.zip.gzipinputstream.<init>(gzipinputstream.java:91)     @ com.mashape.unirest.http.httpresponse.<init>(httpresponse.java:85)     ... 18 common frames omitted 02:09:22.092 [i/o dispatcher 1] debug org.apache.http.impl.nio.conn.managednhttpclientconnectionimpl - http-outgoing-0 192.168.189.147:64147<->104.31.86.157:443[active][r:r][active][r][not_handshaking][0][0][0][0]: shutdown 02:09:22.092 [i/o dispatcher 1] debug org.apache.http.impl.nio.client.internaliodispatch - http-outgoing-0 [closed]: disconnected  java.lang.runtimeexception: java.lang.runtimeexception: java.util.zip.zipexception: not in gzip format      @ com.mashape.unirest.http.httpresponse.<init>(httpresponse.java:106)     @ com.mashape.unirest.http.httpclienthelper$2.get(httpclienthelper.java:120)     @ com.mashape.unirest.http.httpclienthelper$2.get(httpclienthelper.java:104)     @ sensorhealthcheckertest.uniresttest(sensorhealthcheckertest.java:68)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:498)     @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:50)     @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:12)     @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:47)     @ org.junit.internal.runners.statements.invokemethod.evaluate(invokemethod.java:17)     @ org.junit.runners.parentrunner.runleaf(parentrunner.java:325)     @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:78)     @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:57)     @ org.junit.runners.parentrunner$3.run(parentrunner.java:290)     @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:71)     @ org.junit.runners.parentrunner.runchildren(parentrunner.java:288)     @ org.junit.runners.parentrunner.access$000(parentrunner.java:58)     @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:268)     @ org.junit.runners.parentrunner.run(parentrunner.java:363)     @ org.junit.runner.junitcore.run(junitcore.java:137)     @ com.intellij.junit4.junit4ideatestrunner.startrunnerwithargs(junit4ideatestrunner.java:117)     @ com.intellij.junit4.junit4ideatestrunner.startrunnerwithargs(junit4ideatestrunner.java:42)     @ com.intellij.rt.execution.junit.junitstarter.preparestreamsandstart(junitstarter.java:262)     @ com.intellij.rt.execution.junit.junitstarter.main(junitstarter.java:84) caused by: java.lang.runtimeexception: java.util.zip.zipexception: not in gzip format     @ com.mashape.unirest.http.httpresponse.<init>(httpresponse.java:89)     ... 25 more caused by: java.util.zip.zipexception: not in gzip format     @ java.util.zip.gzipinputstream.readheader(gzipinputstream.java:165)     @ java.util.zip.gzipinputstream.<init>(gzipinputstream.java:79)     @ java.util.zip.gzipinputstream.<init>(gzipinputstream.java:91)     @ com.mashape.unirest.http.httpresponse.<init>(httpresponse.java:85)     ... 25 more  disconnected target vm, address: '127.0.0.1:64120', transport: 'socket'  process finished exit code -1 

i expect request executed without errors. noticed works servers https://api.ipify.org?format=json it's not working mine.

the error says response not in gzip format. don't know how react this. should change somehow expected format in unirest or add headers, server returns response in gzip format? should do?

i tried add header accept-encoding: gzip request without success.

here try see if work you. suppose receiving response in gzip format , raw body of response inputstream. not sure how you'd gzip @ least hopefuly shed light.

multipartbody request = unirest.post("url"); future<httpresponse<string>> response = request.asstringasync(new  callback<string>() {              @override             public void failed(unirestexception e) {                //             }              @override             public void completed(httpresponse<string> response) {                 int code = response.getstatus();                 //how converting rawbody gzip?                 inputstream filebody = response.getrawbody();             }              @override             public void cancelled() {                 //             }          }); 

Comments