Index: src/main/java/geniusweb/runserver/Info.java
===================================================================
--- src/main/java/geniusweb/runserver/Info.java	(revision 45)
+++ 	(revision )
@@ -1,41 +1,0 @@
-package geniusweb.runserver;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import geniusweb.protocol.NegoSettings;
-
-/**
- * Contains incoming connection to run a Nego. runserver/runsession with the
- * JSON {@link NegoSettings} in the request header. After the session is
- * started, the new Nego ID is returned. This can be used to find back the log
- * files..
- */
-@SuppressWarnings("serial")
-public class Info extends HttpServlet {
-
-	/**
-	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
-	 *      response).
-	 * 
-	 * @return the ID of the new started run. Or SC_BAD_REQUEST if the request
-	 *         can not be processed.
-	 */
-	@Override
-	protected void doGet(HttpServletRequest request,
-			HttpServletResponse response) throws ServletException, IOException {
-		response.setContentType("text/plain");
-		// HACK but should be generizable easy in the future.
-		Map<String, Object> info = new HashMap<>();
-		info.put("version", getClass().getPackage().getImplementationVersion());
-		response.getWriter()
-				.append(Jackson.instance().writeValueAsString(info));
-	}
-
-}
Index: src/main/java/geniusweb/runserver/Jackson.java
===================================================================
--- src/main/java/geniusweb/runserver/Jackson.java	(revision 45)
+++ 	(revision )
@@ -1,22 +1,0 @@
-package geniusweb.runserver;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * A central generator for the object mapper, so that we can extend the
- * objectmapper (with custom classes) centrally. Also allows us to cache the
- * objectmapper.
- * 
- * <b> This class should is private to the run server and should not be used by
- * others.</b>
- */
-public class Jackson {
-	private static ObjectMapper jackson;
-
-	public static ObjectMapper instance() {
-		if (jackson == null) {
-			jackson = new ObjectMapper();
-		}
-		return jackson;
-	}
-}
Index: src/main/java/geniusweb/runserver/PartyConnection.java
===================================================================
--- src/main/java/geniusweb/runserver/PartyConnection.java	(revision 1)
+++ src/main/java/geniusweb/runserver/PartyConnection.java	(revision 1)
@@ -0,0 +1,226 @@
+package geniusweb.runserver;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.SocketException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.logging.Level;
+
+import javax.websocket.ClientEndpoint;
+import javax.websocket.CloseReason;
+import javax.websocket.ContainerProvider;
+import javax.websocket.DeploymentException;
+import javax.websocket.OnClose;
+import javax.websocket.OnError;
+import javax.websocket.OnMessage;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+import javax.websocket.WebSocketContainer;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import geniusweb.actions.Action;
+import geniusweb.actions.PartyId;
+import geniusweb.party.inform.Inform;
+import geniusweb.protocol.partyconnection.ConnectionWithParty;
+import geniusweb.references.Reference;
+import tudelft.utilities.listener.DefaultListenable;
+import tudelft.utilities.logging.ReportToLogger;
+import tudelft.utilities.logging.Reporter;
+
+/**
+ * A websocket based {@link ConnectionWithParty}. Must be public so that it can
+ * be accessed as ClientEndpoint by apache tomcat
+ */
+@ClientEndpoint
+public class PartyConnection extends DefaultListenable<Action>
+		implements ConnectionWithParty {
+	private final static ObjectMapper jackson = new ObjectMapper();
+	private final Reporter log;
+
+	private final Reference reference;
+
+	private WebSocketContainer container;
+	private Session session = null;
+	private URI partyuri;
+	private Throwable error = null;
+
+	/**
+	 * Constructor that uses default {@link Reporter}
+	 * 
+	 * @param reference the address to to a http GET to get a websocket to a new
+	 *                  running party.
+	 */
+	public PartyConnection(Reference reference) {
+		this(reference, new ReportToLogger("runserver"));
+	}
+
+	/**
+	 * 
+	 * @param reference the address to to a http GET to get a websocket to a new
+	 *                  running party.
+	 * @param reporter  the {@link Reporter} used for logging important
+	 *                  events/issues
+	 * @throws IOException if the party does not start properly.
+	 */
+	public PartyConnection(Reference reference, Reporter reporter) {
+		this.reference = reference;
+		this.log = reporter;
+
+	}
+
+	public PartyConnection init() throws IOException {
+		log.log(Level.INFO, "Trying to start up party " + reference);
+		URI partyuri = startParty(reference);
+
+		container = ContainerProvider.getWebSocketContainer();
+		log.log(Level.INFO,
+				"Trying to make websocket connection to running party "
+						+ partyuri);
+		try {
+			container.connectToServer(this, partyuri);
+		} catch (DeploymentException e) {
+			throw new IOException(
+					"Failed to connect with running party at " + partyuri, e);
+		}
+		log.log(Level.INFO, "Created websocket connection at  " + partyuri);
+		return this;
+	}
+
+	/**
+	 * 
+	 * @param reference the address to to a http GET to get a websocket to a new
+	 *                  running party.
+	 * @return URI of websocket behind which is a running party
+	 * @throws IOException if party did not start correctly
+	 */
+	private URI startParty(Reference reference) throws IOException {
+		HttpURLConnection conn = (HttpURLConnection) reference.getURI().toURL()
+				.openConnection();
+		// if this throws, the IOException seems to contain the "retry later"
+		// message
+		// already
+		conn.setRequestMethod("GET"); // TODO timeout
+		BufferedReader rd;
+		try {
+			rd = new BufferedReader(
+					new InputStreamReader(conn.getInputStream()));
+		} catch (IOException e) {
+			// read the detail message from the error stream
+			rd = new BufferedReader(
+					new InputStreamReader(conn.getErrorStream()));
+			throw new IOException(rd.readLine(), e);
+		}
+		String partysocketaddress = rd.readLine();
+		log.log(Level.INFO, "startparty returned " + partysocketaddress);
+		if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
+			throw new IOException(
+					"Something went wrong connecting to the party:"
+							+ conn.getResponseCode());
+		}
+		try {
+			this.partyuri = new URI(partysocketaddress);
+		} catch (URISyntaxException e1) {
+			throw new IOException("Failed to start party at " + reference, e1);
+		}
+		return partyuri;
+	}
+
+	/************* implements {@link ConnectionWithParty} ***************/
+	@Override
+	public void send(Inform info) throws IOException {
+		if (session == null)
+			return;
+		session.getBasicRemote().sendText(jackson.writeValueAsString(info));
+	}
+
+	@Override
+	public Reference getReference() {
+		return this.reference;
+	}
+
+	@Override
+	public PartyId getParty() {
+		String name = partyuri.getPath();
+		return new PartyId(name.substring(name.lastIndexOf('/') + 1));
+	}
+
+	@Override
+	public void close() {
+		log.log(Level.INFO, "Party close called");
+		setError(new SocketException("socket is closed"));
+		try {
+			session.close();
+			this.session = null;
+		} catch (IOException e) {
+			log.log(Level.SEVERE, "failed to close websocket", e);
+		}
+	}
+
+	/************* implements ClientEndpoint ***************/
+
+	@OnOpen
+	public void onOpen(Session session) {
+		log.log(Level.INFO, "Party is being connected: " + session);
+		this.session = session;
+	}
+
+	@OnClose
+	public void onClose(Session userSession, CloseReason reason) {
+		log.log(Level.INFO, "closing websocket " + reference + ":" + reason);
+		setError(new SocketException("socket has been closed"));
+
+	}
+
+	@OnMessage
+	public void processMessage(String message) {
+		try {
+			Action act = jackson.readValue(message, Action.class);
+			notifyChange(act);
+		} catch (IOException e) {
+			log.log(Level.WARNING,
+					"received bad message from client " + reference, e);
+			setError(e);
+			close();
+		}
+	}
+
+	@OnError
+	public void processError(Throwable t) {
+		log.log(Level.SEVERE, "Something went wrong internally!", t);
+		setError(t);
+	}
+
+	@Override
+	public URI getRemoteURI() {
+		return partyuri;
+	}
+
+	@Override
+	public Throwable getError() {
+		return error;
+	}
+
+	/**
+	 * Sets the connection to final error state and report null to listeners.
+	 * Only the first error is reported, the rest is ignored.
+	 * 
+	 * @param err the error that occurred.
+	 */
+	private void setError(Throwable err) {
+		boolean isSet = false;
+		synchronized (this) {
+			if (this.error == null) {
+				this.error = err;
+				isSet = true;
+			}
+		}
+		if (isSet) {
+			notifyChange(null);
+		}
+	}
+
+}
Index: src/main/java/geniusweb/runserver/PartyConnectionFactory.java
===================================================================
--- src/main/java/geniusweb/runserver/PartyConnectionFactory.java	(revision 45)
+++ src/main/java/geniusweb/runserver/PartyConnectionFactory.java	(revision 1)
@@ -12,6 +12,6 @@
 import java.util.logging.Level;
 
-import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
-import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
+import geniusweb.protocol.partyconnection.ConnectionWithParty;
+import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
 import geniusweb.references.PartyRef;
 import geniusweb.references.Reference;
@@ -23,5 +23,5 @@
  * following the partiesserver protocols.
  */
-class PartyConnectionFactory implements ProtocolToPartyConnFactory {
+class PartyConnectionFactory implements ConnectionWithPartyFactory {
 	private final Reporter log;
 
@@ -35,8 +35,8 @@
 
 	@Override
-	public WebSocketProtToPartyConn connect(Reference reference)
+	public PartyConnection connect(Reference reference)
 			throws IOException, NoResourcesNowException {
 		try {
-			return new WebSocketProtToPartyConn(reference, log).init();
+			return new PartyConnection(reference, log).init();
 		} catch (IOException e) {
 			Date date = getWaitingTime(e);
@@ -60,5 +60,5 @@
 
 	@Override
-	public List<ProtocolToPartyConn> connect(List<Reference> references)
+	public List<ConnectionWithParty> connect(List<Reference> references)
 			throws IOException, NoResourcesNowException {
 		/*
@@ -70,8 +70,8 @@
 		 */
 		log.log(Level.INFO, "attempting to connect " + references);
-		List<ProtocolToPartyConn> connections = new LinkedList<>();
+		List<ConnectionWithParty> connections = new LinkedList<>();
 		try {
 			for (Reference partyref : references) {
-				ProtocolToPartyConn conn = null;
+				ConnectionWithParty conn = null;
 				while (conn == null) {
 					try {
@@ -87,5 +87,5 @@
 		} catch (IOException | NoResourcesNowException e) {
 			// free all already created connections
-			for (ProtocolToPartyConn conn : connections) {
+			for (ConnectionWithParty conn : connections) {
 				conn.close();
 			}
Index: src/main/java/geniusweb/runserver/RunNego.java
===================================================================
--- src/main/java/geniusweb/runserver/RunNego.java	(revision 45)
+++ src/main/java/geniusweb/runserver/RunNego.java	(revision 1)
@@ -9,4 +9,6 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
 
 import geniusweb.protocol.NegoSettings;
@@ -23,4 +25,5 @@
 public class RunNego extends HttpServlet {
 	private final Reporter log;
+	private final static ObjectMapper jackson = new ObjectMapper();
 
 	public RunNego() {
@@ -35,8 +38,14 @@
 	/**
 	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
-	 *      response).
-	 * 
-	 * @return the ID of the new started run. Or SC_BAD_REQUEST if the request
-	 *         can not be processed.
+	 *      response). Returns
+	 *      <ul>
+	 *      <li>URL with websocket address to contact the now running party.
+	 *      <li>SC_NOT_FOUND (404) if attempt is made to access non-running
+	 *      party.
+	 *      <li>SC_SERVICE_UNAVAILABLE (503) if there are no free slots to run
+	 *      the party.
+	 *      <li>SC_EXPECTATION_FAILED (417) if something else goes wrong during
+	 *      instantiating the party (then see logs for more details)
+	 *      </ul>
 	 */
 	@Override
@@ -47,21 +56,15 @@
 		NegoSettings settings;
 		try {
-			settings = Jackson.instance().readValue(reqstring,
-					NegoSettings.class);
+			settings = jackson.readValue(reqstring, NegoSettings.class);
 		} catch (IOException e) {
 			response.sendError(HttpServletResponse.SC_BAD_REQUEST,
 					e.getMessage());
-			System.err.println("Run request failed " + reqstring);
-			e.printStackTrace(); // helpful for debugging run requests
 			return;
 		}
 		log.log(Level.INFO, "request to run Nego: " + settings);
-		RunningNego running = new RunningNego(settings,
+		RunningNego session = new RunningNego(settings,
 				RunningNegotiationsRepo.instance(), log);
-		running.start();
-		// set content type to prevent some browsers
-		// trying to parse this (eg as XML)
-		response.setContentType("application/json");
-		response.getWriter().append(running.getID());
+		RunningNegotiationsRepo.instance().put(session);
+		response.getWriter().append(session.getID());
 	}
 
Index: src/main/java/geniusweb/runserver/RunningNego.java
===================================================================
--- src/main/java/geniusweb/runserver/RunningNego.java	(revision 45)
+++ src/main/java/geniusweb/runserver/RunningNego.java	(revision 1)
@@ -8,4 +8,6 @@
 import java.nio.file.Paths;
 import java.util.logging.Level;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
 
 import geniusweb.events.ProtocolEvent;
@@ -25,5 +27,6 @@
 	private static final String LOGDIRNAME = "log";
 	private static final Path logdir = getLogDir();
-	private static long negoNr = System.currentTimeMillis(); // generate unique IDs.
+	private static int negoNr = 1; // generate unique IDs.
+	private static final ObjectMapper jackson = new ObjectMapper();
 
 	private final String sessionid;
@@ -33,6 +36,5 @@
 
 	/**
-	 * Create new session wth unique ID. You should call {@link #start()} to
-	 * actually start this.
+	 * Create new session wth unique ID.
 	 * 
 	 * @param settings the settings to use for this session
@@ -46,14 +48,10 @@
 			Reporter logger) {
 		this.log = logger;
-		this.protocol = settings.getProtocol(logger);
+		protocol = settings.getProtocol(logger);
 		this.sessionid = "" + protocol.getRef().getURI() + (negoNr++);
 		this.repo = repo;
-	}
-
-	public void start() {
-		log.log(Level.INFO, "new negotiation session. logging to " + logdir);
-		repo.put(this);
+		System.out.println("new session. logging to " + logdir);
 		protocol.addListener(evt -> handle(evt));
-		protocol.start(new PartyConnectionFactory(log));
+		protocol.start(new PartyConnectionFactory(logger));
 	}
 
@@ -78,7 +76,7 @@
 			PrintWriter out = new PrintWriter(
 					logdir.resolve(sessionid + ".json").toFile());
-			out.print(Jackson.instance().writeValueAsString(sessionState));
+			out.print(jackson.writeValueAsString(sessionState));
 			out.close();
-		} catch (Throwable e) { // also catch outOfMem etc.
+		} catch (IOException e) {
 			log.log(Level.SEVERE, "Failed to write log file for " + sessionid,
 					e);
Index: src/main/java/geniusweb/runserver/RunningNegotiationsRepo.java
===================================================================
--- src/main/java/geniusweb/runserver/RunningNegotiationsRepo.java	(revision 45)
+++ src/main/java/geniusweb/runserver/RunningNegotiationsRepo.java	(revision 1)
@@ -55,5 +55,5 @@
 		}
 		negotiations.put(entity.getID(), entity);
-		notifyListeners(entity.getID());
+		notifyChange(entity.getID());
 		log.log(Level.FINEST, "started " + entity.getID());
 	}
@@ -62,5 +62,5 @@
 	public void remove(String id) {
 		negotiations.remove(id);
-		notifyListeners(id);
+		notifyChange(id);
 		log.log(Level.FINEST, "stopped negotiation " + id);
 	}
@@ -73,5 +73,5 @@
 		}
 		negotiations.put(entity.getID(), entity);
-		notifyListeners(entity.getID());
+		notifyChange(entity.getID());
 		log.log(Level.FINEST, "replaced " + entity.getID());
 
Index: src/main/java/geniusweb/runserver/WebSocketProtToPartyConn.java
===================================================================
--- src/main/java/geniusweb/runserver/WebSocketProtToPartyConn.java	(revision 45)
+++ 	(revision )
@@ -1,278 +1,0 @@
-package geniusweb.runserver;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.logging.Level;
-
-import javax.websocket.ClientEndpoint;
-import javax.websocket.CloseReason;
-import javax.websocket.ContainerProvider;
-import javax.websocket.DeploymentException;
-import javax.websocket.OnClose;
-import javax.websocket.OnError;
-import javax.websocket.OnMessage;
-import javax.websocket.OnOpen;
-import javax.websocket.Session;
-import javax.websocket.WebSocketContainer;
-
-import geniusweb.actions.Action;
-import geniusweb.actions.PartyId;
-import geniusweb.inform.Inform;
-import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
-import geniusweb.references.Reference;
-import tudelft.utilities.listener.DefaultListenable;
-import tudelft.utilities.logging.ReportToLogger;
-import tudelft.utilities.logging.Reporter;
-
-/**
- * A websocket based {@link ProtocolToPartyConn}. it contains a websocket
- * connection to a party (that will be started using the partyserver
- * start-new-party protocol). Must be public so that it can be accessed as
- * ClientEndpoint by apache tomcat. This is internally used.
- * 
- * <p>
- * The @ClientEndpoint annotation is important, the runserver is creating these
- * sockets programatically, from a received ws: URL.
- */
-@ClientEndpoint
-public class WebSocketProtToPartyConn extends DefaultListenable<Action>
-		implements ProtocolToPartyConn {
-	// 20MB seems reasonable limit?
-	private static final int MAX_MESSAGE_SIZE = 20 * 1024 * 1024;
-	private final Reporter log;
-
-	private final Reference reference;
-
-	private WebSocketContainer container;
-	private Session session = null;
-	private URI partyuri;
-	private Throwable error = null;
-
-	/**
-	 * Buffers incoming text.
-	 */
-	private StringBuffer buffer = new StringBuffer();
-
-	/**
-	 * Constructor that uses default {@link Reporter}
-	 * 
-	 * @param reference the address to to a http GET to get a websocket to a new
-	 *                  running party.
-	 */
-	public WebSocketProtToPartyConn(Reference reference) {
-		this(reference, new ReportToLogger("runserver"));
-	}
-
-	/**
-	 * 
-	 * @param reference the address to to a http GET to get a websocket to a new
-	 *                  running party.
-	 * @param reporter  the {@link Reporter} used for logging important
-	 *                  events/issues
-	 * @throws IOException if the party does not start properly.
-	 */
-	public WebSocketProtToPartyConn(Reference reference, Reporter reporter) {
-		this.reference = reference;
-		this.log = reporter;
-
-	}
-
-	public WebSocketProtToPartyConn init() throws IOException {
-		log.log(Level.INFO, "Trying to start up party " + reference);
-		URI partyuri = startParty(reference);
-
-		container = ContainerProvider.getWebSocketContainer();
-		// #50 disable: might cause large buffer. And why is this a good limit
-		// anyway
-		// container.setDefaultMaxTextMessageBufferSize(200000);
-
-		log.log(Level.INFO,
-				"Trying to make websocket connection to running party "
-						+ partyuri);
-		try {
-			container.connectToServer(this, partyuri);
-		} catch (DeploymentException e) {
-			throw new IOException(
-					"Failed to connect with running party at " + partyuri, e);
-		}
-		log.log(Level.INFO, "Created websocket connection at  " + partyuri);
-		return this;
-	}
-
-	/**
-	 * 
-	 * @param reference the address to to a http GET to get a websocket to a new
-	 *                  running party.
-	 * @return URI of websocket behind which is a running party
-	 * @throws IOException if party did not start correctly
-	 */
-	private URI startParty(Reference reference) throws IOException {
-		HttpURLConnection conn = (HttpURLConnection) reference.getURI().toURL()
-				.openConnection();
-		// if this throws, the IOException seems to contain the "retry later"
-		// message already
-		conn.setRequestMethod("GET");
-		conn.setReadTimeout(20000);
-		conn.connect();
-		BufferedReader rd;
-		try {
-			rd = new BufferedReader(
-					new InputStreamReader(conn.getInputStream()));
-		} catch (IOException e) {
-			if (conn.getErrorStream() == null) {
-				throw new IOException("Failed to connect " + reference
-						+ ", no server error message", e);
-			}
-			// read the detail message from the error stream
-			rd = new BufferedReader(
-					new InputStreamReader(conn.getErrorStream()));
-			throw new IOException(rd.readLine(), e);
-		}
-		String partysocketaddress = rd.readLine();
-		log.log(Level.INFO, "startparty returned " + partysocketaddress);
-		if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
-			throw new IOException(
-					"Something went wrong connecting to the party:"
-							+ conn.getResponseCode());
-		}
-		try {
-			this.partyuri = new URI(partysocketaddress);
-		} catch (URISyntaxException e1) {
-			throw new IOException("Failed to start party at " + reference, e1);
-		}
-		return partyuri;
-	}
-
-	/************* implements {@link ConnectionWithParty} ***************/
-	@Override
-	public void send(Inform info) throws IOException {
-		if (session == null)
-			return;
-		session.getBasicRemote()
-				.sendText(Jackson.instance().writeValueAsString(info));
-	}
-
-	@Override
-	public Reference getReference() {
-		return this.reference;
-	}
-
-	@Override
-	public PartyId getParty() {
-		String name = partyuri.getPath();
-		return new PartyId(name.substring(name.lastIndexOf('/') + 1));
-	}
-
-	@Override
-	public void close() {
-		log.log(Level.INFO, "Party close called");
-		// a close event is not necessarily a bug?
-		// setError(new SocketException("socket is closed"));
-		try {
-			session.close();
-			this.session = null;
-		} catch (IOException e) {
-			log.log(Level.SEVERE, "failed to close websocket", e);
-		}
-	}
-
-	/************* implements ClientEndpoint ***************/
-
-	@OnOpen
-	public void onOpen(Session session) {
-		log.log(Level.INFO, "Party is being connected: " + session);
-// #50 we now buffer partial messages
-//		session.setMaxTextMessageBufferSize(MAX_MESSAGE_SIZE);
-//		session.setMaxBinaryMessageBufferSize(MAX_MESSAGE_SIZE);
-		this.session = session;
-	}
-
-	@OnClose
-	public void onClose(Session userSession, CloseReason reason) {
-		log.log(Level.INFO, "closing websocket " + reference + ":" + reason);
-		if (reason.getReasonPhrase() != null
-				&& !reason.getReasonPhrase().isEmpty()) {
-			setError(new RemoteException("Session " + reference
-					+ " closed abnormally (see party server for more details) "
-					+ reason.getReasonPhrase()));
-		}
-		// seems NOT an error. Unless the party deliberately and silently
-		// closes its connection.
-		// Setting error will cause a print of stacktrace that is disturbing.
-		// It seems we can not check at this point if session was finished.
-		// setError(new SocketException("socket has been closed"));
-	}
-
-	@OnMessage
-	public void processMessage(String message, boolean islast) {
-		// #50 avoid fixed (large) buffers
-		buffer.append(message);
-		if (islast) {
-			String msg = buffer.toString();
-			buffer = new StringBuffer();
-			try {
-				Action act = Jackson.instance().readValue(msg, Action.class);
-				notifyListeners(act);
-			} catch (IOException e) {
-				log.log(Level.WARNING,
-						"received bad message from client " + reference, e);
-				setError(e);
-				close();
-			}
-		}
-	}
-
-	@OnError
-	public void processError(Throwable t) {
-		log.log(Level.SEVERE, "Something went wrong internally!", t);
-		setError(t);
-	}
-
-	@Override
-	public URI getRemoteURI() {
-		return partyuri;
-	}
-
-	@Override
-	public Throwable getError() {
-		return error;
-	}
-
-	/**
-	 * Sets the connection to final error state and report null to listeners.
-	 * Only the first error is reported, the rest is ignored.
-	 * 
-	 * @param err the error that occurred.
-	 */
-	private void setError(Throwable err) {
-		boolean isSet = false;
-		synchronized (this) {
-			if (this.error == null) {
-				this.error = err;
-				isSet = true;
-			}
-		}
-		if (isSet) {
-			// special event that tells protocol that we're probably in error
-			// state.
-			notifyListeners(null);
-		}
-	}
-
-}
-
-/**
- * Indicates an exceeption occured on a remote machine. The remote machine did
- * not pass a stacktrace (because it does not fit into a websocket close call).
- *
- */
-class RemoteException extends Exception {
-	public RemoteException(String message) {
-		super(message, null, false, false);
-
-	}
-}
