Is it a requirement that we cannot take dependencies on standard http libraries? If not we could use a library like: http://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient