void () { if (HttpConfigurable.getInstance() == null) { myCheckButton.setVisible(false); return; } myCheckButton.addActionListener(event -> { String error = isValid(); if (error != null) { Messages.showErrorDialog(myMainPanel, error); return; } final HttpConfigurable settings = HttpConfigurable.getInstance(); final String title = IdeBundle.message("dialog.title.check.proxy.settings"); final String url = Messages.showInputDialog(myMainPanel, IdeBundle.message("message.text.enter.url.to.check.connection"), title, Messages.getQuestionIcon(), settings.CHECK_CONNECTION_URL, null); if (StringUtil.isEmptyOrSpaces(url)) { return; } settings.CHECK_CONNECTION_URL = url; try { apply(settings); } catch (ConfigurationException e) { return; } final AtomicReference<IOException> exceptionReference = new AtomicReference<>(); ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> { try { HttpRequests.request(url).readTimeout(3 * 1000).tryConnect(); } catch (IOException e) { exceptionReference.set(e); } }, IdeBundle.message("progress.title.check.connection"), true, null); reset(settings); // since password might have been set final IOException exception = exceptionReference.get(); if (exception == null) { Messages.showMessageDialog(myMainPanel, IdeBundle.message("message.connection.successful"), title, Messages.getInformationIcon()); } else { final String message = exception.getMessage(); if (settings.USE_HTTP_PROXY) { settings.LAST_ERROR = message; } Messages.showErrorDialog(myMainPanel, errorText(message)); } }); }