private void listenForConnections()
    {
        try
        {
            Socket acceptedSocket = serverSocket.accept();
            ObjectInputStream ois = new ObjectInputStream(acceptedSocket.getInputStream());
            ObjectOutputStream oos = new ObjectOutputStream(acceptedSocket.getOutputStream());
            String command = (String) ois.readObject();
            
            if (command.equals(BIND))
            {
                // String objectString = (String) ois.readObject();
                Reference reference = (Reference) ois.readObject();
                System.out.println("Binding some object from " + reference.getHost() + ":"
                        + reference.getPort() + " to \"" + reference.getName() + "\"");
                references.put(reference.getName(), reference);
            }
            else if (command.equals(LOOKUP))
            {
                // send them the reference and have them make the connection themselves
                
                String objectString = (String) ois.readObject();
                System.out.println("Reference for \"" + objectString + "\" requested");
                oos.writeObject(references.get(objectString));
            }
            else if (command.equals(LIST))
            {
                // send them the list of reference and have them make the connection themselves
                
                oos.writeObject(references);
            }
            else
            {
                System.err.println("Command \"" + command + "\" unrecognized!");
            }
            
            ois.close();
            oos.close();
        }
        catch (IOException e)
        {
            System.err.println("Error encountered while listening for client!");
            e.printStackTrace();
        }
        catch (ClassNotFoundException e)
        {
            System.err.println("Error encountered while trying to read object from client!");
            e.printStackTrace();
        }
        catch (Exception e)
        {
            System.err.println(e.getMessage());
        }
    }