Invalid status code on Head request, java custom server

Hi Im trying to connect ODKcollect with my custom java server as
alternative to ODKaggregate, so I have a servlet that receive a http POST
to submit the forms from my mobile device using ODK, when I try to upload
the forms I have this error Invalid status code on Head request. If you
have a web proxy, you may need to login to your network.
I was reading
about this error here in the ODK groups and other pages and i was trying to
implement the JAVA OpenRosa API but I can´t do it works, Im sure that the
response of my server is 201 because Im testing the servlet with a client .
Please anyone could you help me with this or give some ideas that how can I
do this?