Hi Ron Sigal,
Thanks for your reply.I had resolved the problem. Actually the problem was on my side.
client.setSocketFactory(getSocketFactory());
should be set only for the transport protocol "sslsocket". The mistake what I made is, I had set the above for the transport protocol "socket". So I got the StreamCorruptedException. Now its working perfectly.