<file_sep>package server_side;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class MySerialServer implements Server
{
    private ServerSocket listener = null;
    private boolean _run = true;

    public void start(int port, ClientHandler c)
    {
        try
        {
            this.listener = new ServerSocket(port);
        }
        catch (IOException e)
        {
            e.printStackTrace();
            return;
        }
        System.out.println("Serial-Server started listening...");

        Runnable runnable = () ->
        {
            while(this._run)
            {
                try
                {
                    this.listener.setSoTimeout(10000);
                    Socket s = this.listener.accept();
                    System.out.println("Connection established.");

                    c.handleClient(s.getInputStream(), s.getOutputStream());
                }

                catch (IOException | NullPointerException e)
                {
                    e.printStackTrace();
                }

            }
        };

        Thread thread = new Thread(runnable);
        thread.start();
    }

    public void stop()
    {
        this._run = false;

        try
        {
            this.listener.close();
        }

        catch (IOException e)
        {
            e.printStackTrace();
        }
    }

}
<file_sep>package test;

import server_side.*;

import java.util.List;

public class TestSetter {
	

	static Server s; 
	
	public static void runServer(int port) {
		// put the code here that runs your server

		CacheManager cm = new FileCacheManager();
		Searcher<Pair<Integer,Integer>> searcher = new BestFirstSearch<>();

		Solver<Searchable<Pair<Integer, Integer>>,
				List<State<Pair<Integer, Integer>>>> solver = new SearcherAdapter<>(searcher);

		ClientHandler c1 = new MyClientHandler(solver, cm);
		s = new MySerialServer();

		s.start(port, c1);
	}

	public static void stopServer() {
		s.stop();
	}
	

}
