Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lyo-dev] Proxy Settings

Thanks Jan-Patrick,

 

I have reported it in https://github.com/eclipse/lyo.client/issues/60. Let’s see if we can integrate it into the Client.

 

--

–Andrew.

 

Från: <lyo-dev-bounces@xxxxxxxxxxx> på uppdrag av Jan-Patrick Osterloh <osterloh@xxxxxxxx>
Svara till: Lyo project developer discussions <lyo-dev@xxxxxxxxxxx>
Datum: tisdag, 14 maj 2019, W20 15:14
Till: "lyo-dev@xxxxxxxxxxx" <lyo-dev@xxxxxxxxxxx>
Ämne: Re: [lyo-dev] Proxy Settings

 

If anyone has a similar problem, here is what I did: 

       ProxySelector.setDefault(new ProxySelector() {
                @Override
                public List<Proxy> select(URI uri) {
                    ArrayList<Proxy> list = new ArrayList<Proxy>();
                    list.add(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy.de", 8080)));
                    return list;
                }

                @Override
                public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
                    logger.error("Error in ProxySelector, connection Failed: ", ioe);
                }
       });

       Authenticator.setDefault(new ProxyAuth(Config.getProxyUsername(), Config.getProxyPassword()));

That has to be set prior to the first Internet use, plus the following class for Basic Authentizication: 

public class ProxyAuth extends Authenticator {
    private PasswordAuthentication auth;

    public ProxyAuth(String user, String password) {
        auth = new PasswordAuthentication(user, password == null ? new char[] {} : password.toCharArray());
    }

    protected PasswordAuthentication getPasswordAuthentication() {
        return auth;
    }
}



Back to the top