<commit_before>package org.sunricher.wifi.mqtt;

import java.io.IOException;
import java.io.OutputStream;
import java.util.UUID;

import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.sunricher.wifi.api.ColorHandler;
import org.sunricher.wifi.api.ColorHandlerImpl;
import org.sunricher.wifi.api.DeviceHandler;
import org.sunricher.wifi.api.DeviceHandlerImpl;

public class Client {
	private static String mqttServer;
	private static String ledControllerHost;
	private static int ledControllerPort;
	private static String topic;
	private static DeviceHandler device = null;
	private static MqttClient mqttClient;
	private static boolean connecctionInProgress = false;
	private static OutputStream sessionOutputStream = null;
	private static ColorHandler ledHandler;

	public static void main(String[] args) throws Exception {
		if (StringUtils.isBlank(args[0]) || StringUtils.isBlank(args[1]) || StringUtils.isBlank(args[2])
				|| StringUtils.isBlank(args[3]) || !StringUtils.isNumeric(args[3])) {
			System.out.println("Missing arguments");
			return;
		}
		// args
		mqttServer = args[0];
		topic = args[1];
		ledControllerHost = args[2];
		ledControllerPort = new Integer(args[3]);

		// connect to controller
		connectToController(false);
		device = new DeviceHandlerImpl();

		// connect to MQTT broker
		startMQTTClient();

		// add handle for ctrl+c to disconnect
		Runtime.getRuntime().addShutdownHook(new Thread() {

			@Override
			public void run() {
				try {
					System.out.println("Disconnecting from server");
					device.disconnect();
					mqttClient.disconnect();
				} catch (IOException | MqttException e) {
					// we cannot do much here.
					e.printStackTrace();
				}
			}
		});
	}<commit_msg>fix connection<commit_after>package org.sunricher.wifi.mqtt;

import java.io.IOException;
import java.io.OutputStream;
import java.util.UUID;

import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.sunricher.wifi.api.ColorHandler;
import org.sunricher.wifi.api.ColorHandlerImpl;
import org.sunricher.wifi.api.DeviceHandler;
import org.sunricher.wifi.api.DeviceHandlerImpl;

public class Client {
	private static String mqttServer;
	private static String ledControllerHost;
	private static int ledControllerPort;
	private static String topic;
	private static DeviceHandler device = null;
	private static MqttClient mqttClient;
	private static boolean connecctionInProgress = false;
	private static OutputStream sessionOutputStream = null;
	private static ColorHandler ledHandler;

	public static void main(String[] args) throws Exception {
		if (StringUtils.isBlank(args[0]) || StringUtils.isBlank(args[1]) || StringUtils.isBlank(args[2])
				|| StringUtils.isBlank(args[3]) || !StringUtils.isNumeric(args[3])) {
			System.out.println("Missing arguments");
			return;
		}
		// args
		mqttServer = args[0];
		topic = args[1];
		ledControllerHost = args[2];
		ledControllerPort = new Integer(args[3]);
		
		// connect to controller
		device = new DeviceHandlerImpl();
		connectToController(false);
		

		// connect to MQTT broker
		startMQTTClient();

		// add handle for ctrl+c to disconnect
		Runtime.getRuntime().addShutdownHook(new Thread() {

			@Override
			public void run() {
				try {
					System.out.println("Disconnecting from server");
					device.disconnect();
					mqttClient.disconnect();
				} catch (IOException | MqttException e) {
					// we cannot do much here.
					e.printStackTrace();
				}
			}
		});
	}
{'fraction_non_alphanumeric': 0.1095890410958904, 'fraction_numerical': 0.006575342465753425, 'mean_word_length': 4.490225563909775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '398062', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1127, 'n_words': 263}