@@ -0,0 +1,1620 @@
+package uk.me.graphe.server;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.net.Socket;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.json.JSONException;%0Aimport org.json.JSONObject;%0A%0Aimport uk.me.graphe.server.GraphemeServer;%0Aimport uk.me.graphe.server.messages.Message;%0Aimport uk.me.graphe.server.messages.MessageFactory;%0A%0Apublic class TestClient %7B%0A%0A    private Socket mSock = new Socket();%0A%0A    public void bringUpServer() %7B%0A        GraphemeServer.getInstance().start();%0A    %7D%0A%0A    public void connect() %7B%0A        try %7B%0A            mSock = new Socket(%22localhost%22, 6689);%0A        %7D catch (Throwable t) %7B%0A            throw new Error(t);%0A        %7D%0A%0A    %7D%0A%0A    public void sendMessage(Message m) %7B%0A        try %7B%0A            mSock.getOutputStream().write((m.toJson() + %22%5C0%22).getBytes());%0A        %7D catch (IOException e) %7B%0A            throw new Error(e);%0A        %7D%0A    %7D%0A%0A    public Message readNextMessage() %7B%0A        StringBuilder sb = new StringBuilder();%0A        InputStream is;%0A        try %7B%0A            is = mSock.getInputStream();%0A%0A            do %7B%0A                sb.append((char) is.read());%0A            %7D while (sb.charAt(sb.length()-1) != '%5C0');%0A            %0A            JSONObject jso = new JSONObject(sb.toString().substring(0,sb.length()-1));%0A            List%3CJSONObject%3E jsos = new ArrayList%3CJSONObject%3E();%0A            jsos.add(jso);%0A            return MessageFactory.makeOperationsFromJson(jsos).get(0);%0A            %0A        %7D catch (IOException e) %7B%0A            throw new Error(e);%0A        %7D catch (JSONException e) %7B%0A            throw new Error(e);%0A        %7D%0A    %7D%0A%7D%0A

add a client for testing the server