The problem lies in the way the emulator handles
DataOutputStream. If you use flush() afte you write to the stream, it somehow adds chunks of data to the request being sent down the stream (which I think is due to encoding problems). Remove flush() from your code and see what happens.