test_class.file: metrics-influxdb/src/test/java/com/izettle/metrics/influxdb/InfluxDbTcpSenderTest.java
test_class.identifier: InfluxDbTcpSenderTest
test_case.body: @Test(expected = ConnectException.class)
      public void shouldThrowConnectionException() throws Exception {
          InfluxDbTcpSender influxDbTcpSender = new InfluxDbTcpSender(
              "0.0.0.0",
              10080,
              1000,
              "test",
              ""
          );
          influxDbTcpSender.writeData(new byte[0]);
      }
test_case.class_method_signature: InfluxDbTcpSenderTest.shouldThrowConnectionException()
test_case.full_signature: @Test(expected = ConnectException.class) public void shouldThrowConnectionException()
test_case.identifier: shouldThrowConnectionException
test_case.invocations: writeData
test_case.modifiers: @Test(expected = ConnectException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldThrowConnectionException()
focal_class.declarator: NUM_OF_RETRIES = 2
focal_class.modifier: private static final
focal_class.original_string: private static final int NUM_OF_RETRIES = 2;
focal_class.type: int
focal_class.var_name: NUM_OF_RETRIES
focal_class.declarator: TCP_TIME_PRECISION = TimeUnit.NANOSECONDS
focal_class.modifier: private static final
focal_class.original_string: private static final TimeUnit TCP_TIME_PRECISION = TimeUnit.NANOSECONDS;
focal_class.type: TimeUnit
focal_class.var_name: TCP_TIME_PRECISION
focal_class.declarator: hostname
focal_class.modifier: private final
focal_class.original_string: private final String hostname;
focal_class.type: String
focal_class.var_name: hostname
focal_class.declarator: port
focal_class.modifier: private final
focal_class.original_string: private final int port;
focal_class.type: int
focal_class.var_name: port
focal_class.declarator: socketTimeout
focal_class.modifier: private final
focal_class.original_string: private final int socketTimeout;
focal_class.type: int
focal_class.var_name: socketTimeout
focal_class.declarator: tcpSocket
focal_class.modifier: private
focal_class.original_string: private Socket tcpSocket;
focal_class.type: Socket
focal_class.var_name: tcpSocket
focal_class.file: metrics-influxdb/src/main/java/com/izettle/metrics/influxdb/InfluxDbTcpSender.java
focal_class.identifier: InfluxDbTcpSender
focal_class.class_method_signature: InfluxDbTcpSender.InfluxDbTcpSender(
          final String hostname,
          final int port,
          final int socketTimeout,
          final String database,
          final String measurementPrefix)
focal_class.full_signature: public  InfluxDbTcpSender(
          final String hostname,
          final int port,
          final int socketTimeout,
          final String database,
          final String measurementPrefix)
focal_class.identifier: InfluxDbTcpSender
focal_class.modifiers: public
focal_class.parameters: (
          final String hostname,
          final int port,
          final int socketTimeout,
          final String database,
          final String measurementPrefix)
focal_class.signature:  InfluxDbTcpSender(
          final String hostname,
          final int port,
          final int socketTimeout,
          final String database,
          final String measurementPrefix)
focal_class.class_method_signature: InfluxDbTcpSender.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.class_method_signature: InfluxDbTcpSender.retryConnect(boolean force)
focal_class.full_signature: private void retryConnect(boolean force)
focal_class.identifier: retryConnect
focal_class.modifiers: private
focal_class.parameters: (boolean force)
focal_class.return: void
focal_class.signature: void retryConnect(boolean force)
focal_class.superclass: extends InfluxDbBaseSender
focal_method.body: @Override
      protected int writeData(byte[] line) throws Exception {
          retryConnect(false);
  
          for (int i = 1; i <= NUM_OF_RETRIES; i++) {
              try {
                  OutputStream outputStream = tcpSocket.getOutputStream();
                  outputStream.write(line);
                  outputStream.flush();
  
                  return 0;
              } catch (IOException e) {
                  // In case of exception, force reconnect
                  retryConnect(true);
              }
          }
  
          return 0;
      }
focal_method.class_method_signature: InfluxDbTcpSender.writeData(byte[] line)
focal_method.full_signature: @Override protected int writeData(byte[] line)
focal_method.identifier: writeData
focal_method.invocations: retryConnect getOutputStream write flush retryConnect
focal_method.modifiers: @Override protected
focal_method.parameters: (byte[] line)
focal_method.return: int
focal_method.signature: int writeData(byte[] line)