I faced very strange problem. Writing a credit card applicatoin to download some data from online with proxy server support I made the decision to make use of Apache's HttpClient library. jar binaries were effectively put into NetBeans project and also the following code snippet was performed (effectively too) inside a simple application:

DefaultHttpClient httpclient = new DefaultHttpClient();
String proxyHost = "192.168.4.10";
Integer proxyPort = 8080;

HttpHost targetHost = new HttpHost("noaasis.noaa.gov", 80, "http");
HttpGet httpget = new HttpGet("/ptbus/ptbus167");

try {

    HttpHost proxy = new HttpHost(proxyHost, proxyPort);
    httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

    System.out.println("executing request: " + httpget.getRequestLine());
    System.out.println("via proxy: " + proxy);
    System.out.println("to target: " + targetHost);

    HttpResponse response = httpclient.execute(targetHost, httpget);
    HttpEntity entity = response.getEntity();

    System.out.println("----------------------------------------");
    System.out.println(response.getStatusLine());
    Header[] headers = response.getAllHeaders();
    for (int i = 0; i<headers.length; i++) {
        System.out.println(headers[i]);
    }

    System.out.println("----------------------------------------");
    System.out.println(response.getStatusLine());
    if (entity != null) {
        System.out.println("Response content length: " + entity.getContentLength());
    }
    EntityUtils.consume(entity);

}
catch (IOException ex) {

}
finally {
    // When HttpClient instance is no longer needed,
    // shut down the connection manager to ensure
    // immediate deallocation of all system resources
    httpclient.getConnectionManager().shutdown();
}

However when I attempt to complete exactly the same factor in Swing application it does not work. For instance, spinning default Netbeans desktop application's "about" action listener the following

@Action
public void showAboutBox() {

    new Thread(new Runnable() {

        public void run() {

            DefaultHttpClient httpclient = new DefaultHttpClient();

            ......
            ......
            ......

            finally {
                // When HttpClient instance is no longer needed,
                // shut down the connection manager to ensure
                // immediate deallocation of all system resources
                httpclient.getConnectionManager().shutdown();
            }

        }
    }).start();
}

causes application's execution to prevent somewhere in

HttpResponse response = httpclient.execute(targetHost, httpget);

Leastways, it never returns...

The interesting factor is that if I additionally put this code snippet in application's primary method right before creating any Swing instance the pointed out lines are passed and HTTP fact is received. And calling showAboutBox() does not make the problem any longer then - I receive HTTP response too.

What shall we be held doing wrong, men? What is the trick? Can One use Apache's library during my Swing application? I am unable to know very well what happens and did not find anything such as this investing hrs within the internet.

Appreciate attention. Expect any help!

You are obstructing the event dispatch thread (EDT). Use [cde], as proven here.

that only comments nevertheless its more than permitted quantity of chars....

to prevent wrong directions, Swing based gui does not any care that you simply running any one of BackGround Task, Swing is single threaded and all sorts of output towards the GUI should be done on EDT

1/ wrap output towards the GUI towards the SwingUtilities.invokeLater(), that's produced your personal EDT, and when there EDT exist then move actual task towards the finishes from the EDT

2/ wrap output towards the GUI by utilizing javax.swing.Action

3/ or as trashgod recommended let us SwingWorker works for your +1