Q:

Sending POST request with Form params through java don´t get response

I'm trying to send a request to a REST Web service through Java.
I need to send some form params to the web service, because they are too big to send by queryParams.
The httpRequest method that sends is the following:
public static String sendPostWithParams(String urlParam, Map<String, Object> params) throws Exception {
    URL url = new URL(urlParam);

    StringBuilder postData = new StringBuilder();
    for (Map.Entry<String, Object> param : params.entrySet()) {
        if (postData.length() != 0)
            postData.append('&');
        postData.append(URLEncoder.encode(param.getKey(), "UTF-8"));
        postData.append('=');
        postData.append(URLEncoder.encode(String.valueOf(param.getValue()), "UTF-8"));
    }
    byte[] postDataBytes = postData.toString().getBytes("UTF-8");

    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("POST");
    conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length));
    conn.setDoOutput(true);
    conn.getOutputStream().write(postDataBytes);
    conn.connect(); 

    DataOutputStream wr = new DataOutputStream(conn.getOutputStream());

    wr.flush();
    wr.close();

    int responseCode = conn.getResponseCode();
    BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));

    // print result
    return response.toString();
}

I've tried to send the request through Postman and it works fine, just like expected. But when I try to send the request through Java, I get the two following lines printed in the console, and then it just freezes there until it timeouts.
15:18:18,160 INFORMACIÓN [org.jboss.resteasy.cdi.CdiInjectorFactory] (http--0.0.0.0-8080-1) Found BeanManager at java:comp/BeanManager
15:18:18,170 INFORMACIÓN [org.jboss.resteasy.spi.ResteasyDeployment] (http--0.0.0.0-8080-1) Deploying javax.ws.rs.core.Application: class .com.services.rest.ApplicationConfig$Proxy$_$$_WeldClientProxy

The web service is not being called, because I have a breakpoint there and it never reaches it.
So I think the problem may be in the way I generated the request through Java, but I haven't found another way to do it.
Thanks in advance.

A:

Ok, I´ve solved. The way I was sending the request is OK, the service is OK, but I was running JBoss in Debug mode using Eclipse Luna, and that was making it to hang there. So I runned it in run mode, and it works perfectly. So If someone else face it, run in run mode and try. 
Thanks for the help.

