public void run() {
        try {
            while(s.isConnected() && in != null) {

                Serializable data = null;
                try {
                    data = (Serializable) in.readObject();
                } catch (ClassNotFoundException ex) {
                    ex.printStackTrace();
                    System.exit(0);
                }
                System.out.println("Got an update!");
            }
            if (in != null)
                in.close();
            if (!s.isClosed())
                s.close();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (in != null)
                    in.close();
                if (!s.isClosed())
                    s.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }