test_class.file: metrics-influxdb/src/test/java/com/izettle/metrics/influxdb/InfluxDbHttpSenderTest.java
test_class.identifier: InfluxDbHttpSenderTest
test_case.body: @Test(expected = ConnectException.class)
      public void shouldThrowConnectException() throws Exception {
          InfluxDbHttpSender influxDbHttpSender = new InfluxDbHttpSender(
              "http",
              "localhost",
              10080,
              "testdb",
              "asdf",
              TimeUnit.MINUTES,
              1000,
              1000,
              ""
          );
          influxDbHttpSender.writeData(new byte[0]);
      }
test_case.class_method_signature: InfluxDbHttpSenderTest.shouldThrowConnectException()
test_case.full_signature: @Test(expected = ConnectException.class) public void shouldThrowConnectException()
test_case.identifier: shouldThrowConnectException
test_case.invocations: writeData
test_case.modifiers: @Test(expected = ConnectException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldThrowConnectException()
focal_class.declarator: url
focal_class.modifier: private final
focal_class.original_string: private final URL url;
focal_class.type: URL
focal_class.var_name: url
focal_class.declarator: authStringEncoded
focal_class.modifier: private final
focal_class.original_string: private final String authStringEncoded;
focal_class.type: String
focal_class.var_name: authStringEncoded
focal_class.declarator: connectTimeout
focal_class.modifier: private final
focal_class.original_string: private final int connectTimeout;
focal_class.type: int
focal_class.var_name: connectTimeout
focal_class.declarator: readTimeout
focal_class.modifier: private final
focal_class.original_string: private final int readTimeout;
focal_class.type: int
focal_class.var_name: readTimeout
focal_class.file: metrics-influxdb/src/main/java/com/izettle/metrics/influxdb/InfluxDbHttpSender.java
focal_class.identifier: InfluxDbHttpSender
focal_class.class_method_signature: InfluxDbHttpSender.InfluxDbHttpSender(
          final String protocol, final String hostname, final int port, final String database, final String authString,
          final TimeUnit timePrecision, final int connectTimeout, final int readTimeout, final String measurementPrefix)
focal_class.full_signature: public  InfluxDbHttpSender(
          final String protocol, final String hostname, final int port, final String database, final String authString,
          final TimeUnit timePrecision, final int connectTimeout, final int readTimeout, final String measurementPrefix)
focal_class.identifier: InfluxDbHttpSender
focal_class.modifiers: public
focal_class.parameters: (
          final String protocol, final String hostname, final int port, final String database, final String authString,
          final TimeUnit timePrecision, final int connectTimeout, final int readTimeout, final String measurementPrefix)
focal_class.signature:  InfluxDbHttpSender(
          final String protocol, final String hostname, final int port, final String database, final String authString,
          final TimeUnit timePrecision, final int connectTimeout, final int readTimeout, final String measurementPrefix)
focal_class.class_method_signature: InfluxDbHttpSender.InfluxDbHttpSender(
          final String protocol, final String hostname, final int port, final String database, final String authString,
          final TimeUnit timePrecision)
focal_class.full_signature: @Deprecated public  InfluxDbHttpSender(
          final String protocol, final String hostname, final int port, final String database, final String authString,
          final TimeUnit timePrecision)
focal_class.identifier: InfluxDbHttpSender
focal_class.modifiers: @Deprecated public
focal_class.parameters: (
          final String protocol, final String hostname, final int port, final String database, final String authString,
          final TimeUnit timePrecision)
focal_class.signature:  InfluxDbHttpSender(
          final String protocol, final String hostname, final int port, final String database, final String authString,
          final TimeUnit timePrecision)
focal_class.class_method_signature: InfluxDbHttpSender.writeData(byte[] line)
focal_class.full_signature: @Override protected int writeData(byte[] line)
focal_class.identifier: writeData
focal_class.modifiers: @Override protected
focal_class.parameters: (byte[] line)
focal_class.return: int
focal_class.signature: int writeData(byte[] line)
focal_class.superclass: extends InfluxDbBaseSender
focal_method.body: @Override
      protected int writeData(byte[] line) throws Exception {
          final HttpURLConnection con = (HttpURLConnection) url.openConnection();
          con.setRequestMethod("POST");
          if (authStringEncoded != null && !authStringEncoded.isEmpty()) {
              con.setRequestProperty("Authorization", "Basic " + authStringEncoded);
          }
          con.setDoOutput(true);
          con.setConnectTimeout(connectTimeout);
          con.setReadTimeout(readTimeout);
  
          OutputStream out = con.getOutputStream();
          try {
              out.write(line);
              out.flush();
          } finally {
              out.close();
          }
  
          int responseCode = con.getResponseCode();
  
          // Check if non 2XX response code.
          if (responseCode / 100 != 2) {
              throw new IOException(
                  "Server returned HTTP response code: " + responseCode + " for URL: " + url + " with content :'"
                      + con.getResponseMessage() + "'");
          }
          return responseCode;
      }
focal_method.class_method_signature: InfluxDbHttpSender.writeData(byte[] line)
focal_method.full_signature: @Override protected int writeData(byte[] line)
focal_method.identifier: writeData
focal_method.invocations: openConnection setRequestMethod isEmpty setRequestProperty setDoOutput setConnectTimeout setReadTimeout getOutputStream write flush close getResponseCode getResponseMessage
focal_method.modifiers: @Override protected
focal_method.parameters: (byte[] line)
focal_method.return: int
focal_method.signature: int writeData(byte[] line)