There exists a method
com.caucho.hessian.client.HessianProxyFactory.setReadTimeout(long
timeout) which allows one to set the socket timeout on requests in
milliseconds. This is ultimately used to call
java.net.URLConnection.setReadTimeout(int) in
com.caucho.hessian.client.HessianProxyFactory.openConnection(java.net.URL).
There is also a corresponding
com.caucho.hessian.client.HessianProxyFactory.getReadTimeout().
If you look at the android docs for java.net.URLConnection, in
addition to set/get methods for the read timeout:
http://developer.android.com/reference/java/net/URLConnection.html#setReadTimeout(int)
http://developer.android.com/reference/java/net/URLConnection.html#getReadTimeout()
There are set/get methods for the connect timeout:
http://developer.android.com/reference/java/net/URLConnection.html#setConnectTimeout(int)
http://developer.android.com/reference/java/net/URLConnection.html#getConnectTimeout()
If you look at the javadoc for the current version (4.0.7) of the
server side Java implementation of Hessian, all 4 of these methods are
supported:
http://www.caucho.com/resin-4.0-javadoc/com/caucho/hessian/client/HessianProxyFactory.html#setReadTimeout(long)
http://www.caucho.com/resin-4.0-javadoc/com/caucho/hessian/client/HessianProxyFactory.html#getReadTimeout()
http://www.caucho.com/resin-4.0-javadoc/com/caucho/hessian/client/HessianProxyFactory.html#setConnectTimeout(long)
http://www.caucho.com/resin-4.0-javadoc/com/caucho/hessian/client/HessianProxyFactory.html#getConnectTimeout()
This appears to be present in hessian 4.0.3:
http://caucho.com/download/hessian-4.0.3-src.jar
but not in hessian 4.0.1:
http://caucho.com/download/hessian-4.0.1-src.jar
(There does not appear to exist a hessian 4.0.2, at least not at
http://hessian.caucho.com/#Java)
But hessdroid (as of rev 29:a1c0504b5811) only supports the read
timeout, and not the connect timeout.
My suggestion is to add support for the connect timeout. A patch is
attached.
Original issue reported on code.google.com by nospam...@yahoo.com on 16 Jan 2012 at 10:02
Original issue reported on code.google.com by
nospam...@yahoo.com
on 16 Jan 2012 at 10:02Attachments: