// Path: src/name/admitriev/jhelper/ui/Notificator.java
// public class Notificator {
// 	private static final NotificationGroup GROUP = NotificationGroupManager.getInstance().getNotificationGroup("JHelper");
// 
// 	private Notificator() {
// 	}
// 
// 	public static void showNotification(String title, String content, NotificationType notificationType) {
// 		GROUP.createNotification(title, content, notificationType, null).notify(null);
// 	}
// 
// 	public static void showNotification(String content, NotificationType notificationType) {
// 		showNotification("", content, notificationType);
// 	}
// }


import com.intellij.notification.NotificationType;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.util.Consumer;
import name.admitriev.jhelper.ui.Notificator;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
package name.admitriev.jhelper.network;



/**
 * Simple HTTP Server.
 * Passes every request without headers to given Consumer
 */
public class SimpleHttpServer implements Runnable {
	private Consumer<String> consumer;
	private ServerSocket serverSocket = null;

	public SimpleHttpServer(SocketAddress endpoint, Consumer<String> consumer) throws IOException {
		serverSocket = new ServerSocket();
		serverSocket.bind(endpoint);
		this.consumer = consumer;
	}

	@Override
	public void run() {
		while (true) {
			try {
				if (serverSocket.isClosed()) {
					return;
				}
				try (Socket socket = serverSocket.accept()) {
					InputStream inputStream = socket.getInputStream();
					String request = readFromStream(inputStream);
					String[] strings = request.split("\n\n", 2);

					//ignore headers
					if (strings.length < 2) {
// Path: src/name/admitriev/jhelper/ui/Notificator.java
// public class Notificator {
// 	private static final NotificationGroup GROUP = NotificationGroupManager.getInstance().getNotificationGroup("JHelper");
// 
// 	private Notificator() {
// 	}
// 
// 	public static void showNotification(String title, String content, NotificationType notificationType) {
// 		GROUP.createNotification(title, content, notificationType, null).notify(null);
// 	}
// 
// 	public static void showNotification(String content, NotificationType notificationType) {
// 		showNotification("", content, notificationType);
// 	}
// }


// Path: src/name/admitriev/jhelper/network/SimpleHttpServer.java
import com.intellij.notification.NotificationType;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.util.Consumer;
import name.admitriev.jhelper.ui.Notificator;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;

package name.admitriev.jhelper.network;



/**
 * Simple HTTP Server.
 * Passes every request without headers to given Consumer
 */
public class SimpleHttpServer implements Runnable {
	private Consumer<String> consumer;
	private ServerSocket serverSocket = null;

	public SimpleHttpServer(SocketAddress endpoint, Consumer<String> consumer) throws IOException {
		serverSocket = new ServerSocket();
		serverSocket.bind(endpoint);
		this.consumer = consumer;
	}

	@Override
	public void run() {
		while (true) {
			try {
				if (serverSocket.isClosed()) {
					return;
				}
				try (Socket socket = serverSocket.accept()) {
					InputStream inputStream = socket.getInputStream();
					String request = readFromStream(inputStream);
					String[] strings = request.split("\n\n", 2);

					//ignore headers
					if (strings.length < 2) {
						Notificator.showNotification(