Ich versuche, mich über https mit einem Server zu verbinden, der Authentifizierung erfordert. Außerdem habe ich einen HTTP-Proxy in der Mitte, der auch Authentifizierung erfordert. Ich verwende ProxyAuthSecurityHandler zur Authentifizierung mit dem Proxy und BasicAuthSecurityHandler zur Authentifizierung mit dem Server.Kann nicht durch Proxy tunneln. Proxy gibt "HTTP/1.1 407" über https zurück
Empfangen von java.io.IOException: Tunnel über Proxy kann nicht hergestellt werden.
Proxy returns "HTTP/1.1 407 Proxy Auth Required"
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:1525)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect (AbstractDelegateHttpsURLConnection.java:164)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:133)
at org.apache.wink.client.internal.handlers.HttpURLConnectionHandler.processRequest(HttpURLConnectionHandler.java:97)
bemerkte ich, dass die Umsetzung von ProxyAuthSecurityHandler erwartet jedoch 407 Antwortcode, während debug wir nie wegen der geworfen IOException auf den zweiten Teil bekommen.
-Code Snap:
ClientConfig configuration = new ClientConfig();
configuration.connectTimeout(timeout);
MyBasicAuthenticationSecurityHandler basicAuthProps = new MyBasicAuthenticationSecurityHandler();
basicAuthProps.setUserName(user);
basicAuthProps.setPassword(password);
configuration.handlers(basicAuthProps);
if ("true".equals(System.getProperty("setProxy"))) {
configuration.proxyHost(proxyHost);
if ((proxyPort != null) && !proxyPort.equals("")) {
configuration.proxyPort(Integer.parseInt(proxyPort));
}
MyProxyAuthSecurityHandler proxyAuthSecHandler =
new MyProxyAuthSecurityHandler();
proxyAuthSecHandler.setUserName(proxyUser);
proxyAuthSecHandler.setPassword(proxyPass);
configuration.handlers(proxyAuthSecHandler);
}
restClient = new RestClient(configuration);
// create the createResourceWithSessionCookies instance to interact with
Resource resource = getResource(loginUrl);
// Request body is empty
ClientResponse response = resource.post(null);
wink Client-Versionen 1.1.2 und 1.2.1 auch versucht, mit. Das Problem wiederholt sich in beiden.