AnsweredAssumed Answered

peer not authenticated - Rally javatoolkit error

Question asked by Sizz on Apr 24, 2017
Latest reply on Apr 24, 2017 by Sizz

I have been using the rally javatoolkit for a while to add testcases, test results etc without any error. But all of a sudden it started throwing error as " peer not authenticated" . I have referred the pages "rally rest api java toolkit sslpeerunverifiedexception : peer not authenticated" , rally rest api java toolkit sslpeerunverifiedexception : peer not authenticated but they didn't help me. Can someone help me with what I am doing wrong. Also If i need to download a certificate please help me for windows system. Thanks in advance. my code is as below:

import; import; import; import; import; import; import; import; import;  import org.apache.http.conn.ssl.SSLSocketFactory; import org.apache.http.conn.ssl.TrustStrategy; import org.apache.http.conn.scheme.Scheme;   public class ConnnectionTestWithHTTPClient {      public static void main(String[] args) throws URISyntaxException, IOException {           String host = "";         String apiKey = "_abc123";         String applicationName = "Connnection Test With HTTPClient";         RallyRestApi restApi = new RallyRestApi(new URI(host),apiKey);         restApi.setApplicationName(applicationName);          //restApi.setProxy(new URI(""), "MyProxyUsername", "MyProxyPassword");  //SET PROXY SETTINS HERE         HttpClient client = restApi.getClient();         try {             SSLSocketFactory sf = new SSLSocketFactory(new TrustStrategy() {                 public boolean isTrusted(X509Certificate[] certificate, String authType)                     throws CertificateException {                     //trust all certs                     return true;                 }             }, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);             client.getConnectionManager().getSchemeRegistry().register(new Scheme("https", 443, sf));              String workspaceRef = "/workspace/12345"; //USE VALID WORKSPACE OID              GetRequest getRequest = new GetRequest(workspaceRef);             GetResponse getResponse = restApi.get(getRequest);             System.out.println(getResponse.getObject());         } catch (Exception e) {             System.out.println(e);         } finally {             restApi.close();         }        }  }

Also adding to the issue, i found a different error when I changed the port from 443 to 8443. i get " HTTP/1.1 522 Origin Connection Time-out" when i use 8443.