Jagger
 All Classes Namespaces Files Functions Variables Groups Pages
String com.griddynamics.jagger.invoker.http.TcpTrafficInvoker.invoke ( Nothing  query,
String  endpoint 
) throws InvocationException

Makes a number of tcp connections.

Author
Dmitry Kotlyarovv
Parameters
query- empty query
endpoint- url of SuT
Returns
empty string
Exceptions
InvocationExceptionwhen invocation failed

References com.griddynamics.jagger.invoker.http.TcpTrafficInvoker.COUNT.

59  {
60  try {
61  URL url = new URL(endpoint);
62  for (long i = 0; i < COUNT; ++i) {
63  HttpURLConnection connection = (HttpURLConnection) url.openConnection();
64 
65  connection.setInstanceFollowRedirects(false);
66  connection.setUseCaches(false);
67 
68  InputStream is = connection.getInputStream();
69 
70  InputStreamReader isr = new InputStreamReader(is);
71  BufferedReader br = new BufferedReader(isr);
72  String theLine;
73 
74  StringBuilder response = new StringBuilder();
75  while ((theLine = br.readLine()) != null) {
76  response.append(theLine);
77  }
78 
79  connection.disconnect();
80 
81  if (i % 500 == 0) {
82  log.debug("i = {}", i);
83  }
84  }
85  return "";
86  } catch (Exception ex) {
87  throw new InvocationException(ex.getMessage(), ex);
88  }
89  }