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 " javax.net.ssl.SSLPeerUnverifiedException: 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 com.rallydev.rest.RallyRestApi; import com.rallydev.rest.client.HttpClient; import com.rallydev.rest.request.GetRequest; import com.rallydev.rest.response.GetResponse; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.security.cert.CertificateException; import java.security.cert.X509Certificate;  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 = "https://rally1.rallydev.com";         String apiKey = "_abc123";         String applicationName = "Connnection Test With HTTPClient";         RallyRestApi restApi = new RallyRestApi(new URI(host),apiKey);         restApi.setApplicationName(applicationName);          //restApi.setProxy(new URI("http://myproxy.mycompany.com"), "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 "java.io.IOException: HTTP/1.1 522 Origin Connection Time-out" when i use 8443.

Outcomes