public MainThread(Socket s, String password){
        //System.out.println("mainthreadsdfsfsfsdfdf"+password);
        try{
            this.sock=s;
            this.password=password;
            out=new DataOutputStream(s.getOutputStream());
            in=new DataInputStream(s.getInputStream());
            robot=new Robot();
            Runtime.getRuntime().addShutdownHook(new MouseReleaseThread());
            //System.out.println("Password: " + password);
        }
        catch(AWTException ae){
            System.err.println("Robot init failed: " + ae);
        }
        catch(Exception e){
            System.err.println("Error during MainThread init: " + e);
        }
        if(!authenticate()){
            try{
                sock.close();
                JOptionPane.showMessageDialog(null, "The password was incorrect.");
                System.exit(0);
            }
            catch(Exception e){
                e.printStackTrace();
                System.err.println(e);
                System.exit(42);
            }
        }
    }