// Path: src/main/java/de/galan/commons/logging/Logr.java
// public class Logr {
// 
// 	private static final StackWalker WALKER = StackWalker.getInstance(Sets.newHashSet(RETAIN_CLASS_REFERENCE));
// 
// 
// 	/**
// 	 * To be used to get the Log4j2 Logger in a class, eg. <code>private final static Logger LOG = Logr.get();</code>.
// 	 * To avoid the Logger declaration completely, use the class <code>Say</code>.
// 	 */
// 	public static Logger get() {
// 		return LogManager.getLogger(WALKER.getCallerClass(), PayloadMessageFactory.INSTANCE);
// 	}
// 
// }
// 
// Path: src/main/java/de/galan/commons/time/Sleeper.java
// public class Sleeper {
// 
// 	/**
// 	 * Sleep a given time (time is parsed with HumanTime)
// 	 *
// 	 * @param humanTime The time in a format such as 30m10s10ms
// 	 */
// 	public static void sleep(String humanTime) {
// 		sleep(Durations.dehumanize(humanTime));
// 	}
// 
// 
// 	/**
// 	 * Sleep the given milliseconds, swallowing the exception
// 	 *
// 	 * @param millis time in milliseconds
// 	 */
// 	public static void sleep(long millis) {
// 		try {
// 			Thread.sleep(millis);
// 		}
// 		catch (InterruptedException ex) {
// 			Thread.currentThread().interrupt();
// 		}
// 	}
// 
// }


import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.simpleframework.http.core.Container;
import org.simpleframework.http.core.ContainerSocketProcessor;
import org.simpleframework.transport.SocketProcessor;
import org.simpleframework.transport.connect.SocketConnection;
import de.galan.commons.logging.Logr;
import de.galan.commons.time.Sleeper;
		stopServer();
	}


	public synchronized void startServer(Container container) {
		try {
			server = new ContainerSocketProcessor(container);
			connection = new SocketConnection(server);
			SocketAddress address = new InetSocketAddress(getPort());
			connection.connect(address);
			LOG.info("Server started");
		}
		catch (Exception ex) {
			Assertions.fail("Server could not be started", ex);
		}

	}


	protected int getPort() {
		return 12345;
	}


	public void startServerDelayed(final Container container, final String delay) {
		new Thread() {

			@Override
			public void run() {
				Sleeper.sleep(delay);
// Path: src/main/java/de/galan/commons/logging/Logr.java
// public class Logr {
// 
// 	private static final StackWalker WALKER = StackWalker.getInstance(Sets.newHashSet(RETAIN_CLASS_REFERENCE));
// 
// 
// 	/**
// 	 * To be used to get the Log4j2 Logger in a class, eg. <code>private final static Logger LOG = Logr.get();</code>.
// 	 * To avoid the Logger declaration completely, use the class <code>Say</code>.
// 	 */
// 	public static Logger get() {
// 		return LogManager.getLogger(WALKER.getCallerClass(), PayloadMessageFactory.INSTANCE);
// 	}
// 
// }
// 
// Path: src/main/java/de/galan/commons/time/Sleeper.java
// public class Sleeper {
// 
// 	/**
// 	 * Sleep a given time (time is parsed with HumanTime)
// 	 *
// 	 * @param humanTime The time in a format such as 30m10s10ms
// 	 */
// 	public static void sleep(String humanTime) {
// 		sleep(Durations.dehumanize(humanTime));
// 	}
// 
// 
// 	/**
// 	 * Sleep the given milliseconds, swallowing the exception
// 	 *
// 	 * @param millis time in milliseconds
// 	 */
// 	public static void sleep(long millis) {
// 		try {
// 			Thread.sleep(millis);
// 		}
// 		catch (InterruptedException ex) {
// 			Thread.currentThread().interrupt();
// 		}
// 	}
// 
// }


// Path: src/main/java/de/galan/commons/test/vintage/SimpleWebserverTestParent.java
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.simpleframework.http.core.Container;
import org.simpleframework.http.core.ContainerSocketProcessor;
import org.simpleframework.transport.SocketProcessor;
import org.simpleframework.transport.connect.SocketConnection;
import de.galan.commons.logging.Logr;
import de.galan.commons.time.Sleeper;

		stopServer();
	}


	public synchronized void startServer(Container container) {
		try {
			server = new ContainerSocketProcessor(container);
			connection = new SocketConnection(server);
			SocketAddress address = new InetSocketAddress(getPort());
			connection.connect(address);
			LOG.info("Server started");
		}
		catch (Exception ex) {
			Assertions.fail("Server could not be started", ex);
		}

	}


	protected int getPort() {
		return 12345;
	}


	public void startServerDelayed(final Container container, final String delay) {
		new Thread() {

			@Override
			public void run() {
				Sleeper.sleep(delay);
				synchronized (SimpleWebserverTestParent.this) {