Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Loadrunner conducts pressure test of http interface

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

The attachment is from Baidu.

Script body:

/ *

* LoadRunner Javascript. (Build: _ build_number_)

*

* Script Description:

*

, /

Import lrapi.lr

Public class Actions

{

Public int init () throws Throwable {

Return 0

} / / end of init

Public int action () throws Throwable {

Com.CTLPTest ct1 = new com.CTLPTest ()

Ct1.main (null)

Return 0

} / / end of action

Public int end () throws Throwable {

Return 0

} / / end of end

}

Contents of the jar package:

Package com;import java.io.InputStream;import java.net.HttpURLConnection;import java.net.URL;import java.security.cert.X509Certificate;import java.util.Properties;import java.util.Random;import javax.net.ssl.HostnameVerifier;import javax.net.ssl.SSLSession;import javax.net.ssl.X509TrustManager;public class CTLPTest {public static void main (String [] args) {CTLPTest lbs = new CTLPTest (); String ltpUrl = lbs.ltpRequestUrl () System.out.println ("ltpUrl:" + ltpUrl); System.out.println ("lbs.ltpRequestUrl (ltpUrl):" + lbs.ltpRequestUrl (ltpUrl));} public int ltpRequestUrl (String ltpRequestUrl) {int returnCount =-1 Try {URL url = new URL (ltpRequestUrl); Properties prop = System.getProperties (); System.setProperty ("http.proxyHost", "proxy.com"); System.setProperty ("http.proxyPort", "80") / / http HttpURLConnection http = (HttpURLConnection) url.openConnection (); http.setUseCaches (false); http.connect (); / / http InputStream in = http.getInputStream () / / byte [] b = new byte [in.available ()]; in.read (b); / / String res = new String (b); System.out.println ("res:") System.out.println (res); / / res, / int of = res.indexOf ("resultCode") If (of < 0) {System.out.println ("* failure***"); returnCount =-1 } else {returnCount = 1;}} catch (Exception e) {System.out.println ("Exception"); System.out.println (e); returnCount =-1 } return returnCount;} public String ltpRequestUrl () {StringBuilder param = new StringBuilder ("http://xxx.xxx.com");// param.append (" userid-1 "); / / param.append (" & appName=LBS&Apikey=D39hr1FgplZSjV2eNVW71wvbYbl8Mip4 ") Return param.toString ();}}

Attachment: http://down.51cto.com/data/2367948

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report