Fix a bug in POSTs & support SslSocketFactories.

For POSTs and PUTs, HttpURLConnection requires that you set the method before
you write any body data. i.e. writing body data causes the socket to be
opened, at which point you can't set the method anymore. Volley was calling
these two methods in the wrong order; this fixes that.

Separately, this also adds a constructor and appropriate support for a
caller-provided SslSocketFactory. The use case for this is self-signed certs,
where a developer's app is is preloaded with the public key for a specific
server cert not signed by one of the usual CAs. The caller is responsible for
setting up the socket factory with an appropriate keystore, etc.

Change-Id: I2738ce956202b8a8508a733fc7f8b6600cd19bf5
1 file changed