Note: Advice in this article will only work for JxBrowser 6. See the corresponding article for JxBrowser 7 here.


Some proxy servers require authentication. JxBrowser API allows handling proxy server authentication and providing username & password programmatically. The following code demonstrates how to do it: 

browser.getContext().getNetworkService().setNetworkDelegate(new DefaultNetworkDelegate() {
    @Override
    public boolean onAuthRequired(AuthRequiredParams params) {
        if (params.isProxy()) {
            params.setUsername("proxy-username");
            params.setPassword("proxy-password");
            return false;
        }
        return true;
    }
});