java - Unable to make connection using TLSv1.2 -
i new ssl connection. need make https connection using tlsv1.2 in java 7 since paypal has moved sandbox environment tlsv1.2. tried following code found in other posts enable tlsv1.2 , make secure connection using httpclient.
final sslcontext sslcontext = sslcontext.getinstance("tlsv1.2"); sslcontext.init(null, null, null); final schemeregistry schemeregistry = new schemeregistry(); final scheme scheme = new scheme("https", sslcontext.getsocketfactory(), 443); schemeregistry.register(scheme); final basicclientconnectionmanager cm = new basicclientconnectionmanager(schemeregistry); final defaulthttpclient httpclient = new defaulthttpclient(cm); httppost.setentity(new urlencodedformentity(params, "utf-8")); final httpresponse response = httpclient.execute(httppost);
i'm getting error on creating scheme sslcontext.getsocketfactory() since of type sslsocketfactory , scheme looking socketfactory. tried typecast same returned in same problem. please if i'm missing something.
Comments
Post a Comment