hi!!
I didn't get one thing in your code.You have used:
ObjectOutputStream ous = new ObjectOutputStream(s.getOutputStream());
and after that you have again allocated it with:
ous = new ObjectOutputStream(new CipherOutputStream(s.getOutputStream(), cipher));
So, I didn't get this part. when you have already obtained a stream ous, then wy are you not using this stream and re-intializing it.
This must not produce any result.
Anyways, what's the output you are getting?
I think error is with this stream only.
First have a socket -> then obtain a stream -> use it to read/write.
Hope it helped.