Index: /pom.xml
===================================================================
--- /pom.xml	(revision 6)
+++ /pom.xml	(revision 7)
@@ -6,5 +6,5 @@
 	<artifactId>runserver</artifactId>
 	<packaging>war</packaging>
-	<version>1.0.0</version>
+	<version>1.1.0</version>
 	<name>runserver Maven Webapp</name>
 	<url>http://maven.apache.org</url>
@@ -17,5 +17,5 @@
 		<basedir>.</basedir>
 		<passwd>${env.ARTIFACTORY_PASS}</passwd>
-		<jackson-2-version>2.9.6</jackson-2-version>
+		<jackson-2-version>2.9.10</jackson-2-version>
 		<tomcat.version>8.0.53</tomcat.version>
 	</properties>
@@ -53,5 +53,5 @@
 			<groupId>geniusweb</groupId>
 			<artifactId>profile</artifactId>
-			<version>1.0.0</version>
+			<version>1.1.0</version>
 		</dependency>
 
@@ -59,5 +59,5 @@
 			<groupId>geniusweb</groupId>
 			<artifactId>party</artifactId>
-			<version>1.0.0</version>
+			<version>1.1.0</version>
 		</dependency>
 
@@ -65,5 +65,5 @@
 			<groupId>geniusweb</groupId>
 			<artifactId>references</artifactId>
-			<version>1.0.0</version>
+			<version>1.1.0</version>
 		</dependency>
 
@@ -71,5 +71,5 @@
 			<groupId>geniusweb</groupId>
 			<artifactId>protocol</artifactId>
-			<version>1.0.0</version>
+			<version>1.1.0</version>
 		</dependency>
 
@@ -83,5 +83,5 @@
 			<groupId>tudelft.utilities</groupId>
 			<artifactId>listener</artifactId>
-			<version>1.0.0</version>
+			<version>1.1.0</version>
 		</dependency>
 
@@ -187,4 +187,22 @@
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-enforcer-plugin</artifactId>
+				<version>3.0.0-M2</version>
+				<executions>
+					<execution>
+						<id>enforce</id>
+						<configuration>
+							<rules>
+								<dependencyConvergence />
+							</rules>
+						</configuration>
+						<goals>
+							<goal>enforce</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-source-plugin</artifactId>
 				<executions>
@@ -201,5 +219,5 @@
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-dependency-plugin</artifactId>
-				<!--  leave out version to help Eclipse workaround -->
+				<!-- leave out version to help Eclipse workaround -->
 				<executions>
 					<execution>
Index: /src/main/java/geniusweb/runserver/PartyConnectionFactory.java
===================================================================
--- /src/main/java/geniusweb/runserver/PartyConnectionFactory.java	(revision 6)
+++ /src/main/java/geniusweb/runserver/PartyConnectionFactory.java	(revision 7)
@@ -12,6 +12,6 @@
 import java.util.logging.Level;
 
-import geniusweb.protocol.partyconnection.ConnectionWithParty;
-import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
+import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
+import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
 import geniusweb.references.PartyRef;
 import geniusweb.references.Reference;
@@ -23,5 +23,5 @@
  * following the partiesserver protocols.
  */
-class PartyConnectionFactory implements ConnectionWithPartyFactory {
+class PartyConnectionFactory implements ProtocolToPartyConnFactory {
 	private final Reporter log;
 
@@ -35,8 +35,8 @@
 
 	@Override
-	public PartyConnection connect(Reference reference)
+	public WebSocketProtToPartyConn connect(Reference reference)
 			throws IOException, NoResourcesNowException {
 		try {
-			return new PartyConnection(reference, log).init();
+			return new WebSocketProtToPartyConn(reference, log).init();
 		} catch (IOException e) {
 			Date date = getWaitingTime(e);
@@ -60,5 +60,5 @@
 
 	@Override
-	public List<ConnectionWithParty> connect(List<Reference> references)
+	public List<ProtocolToPartyConn> connect(List<Reference> references)
 			throws IOException, NoResourcesNowException {
 		/*
@@ -70,8 +70,8 @@
 		 */
 		log.log(Level.INFO, "attempting to connect " + references);
-		List<ConnectionWithParty> connections = new LinkedList<>();
+		List<ProtocolToPartyConn> connections = new LinkedList<>();
 		try {
 			for (Reference partyref : references) {
-				ConnectionWithParty conn = null;
+				ProtocolToPartyConn conn = null;
 				while (conn == null) {
 					try {
@@ -87,5 +87,5 @@
 		} catch (IOException | NoResourcesNowException e) {
 			// free all already created connections
-			for (ConnectionWithParty conn : connections) {
+			for (ProtocolToPartyConn conn : connections) {
 				conn.close();
 			}
Index: /src/main/java/geniusweb/runserver/RunningNegotiationsRepo.java
===================================================================
--- /src/main/java/geniusweb/runserver/RunningNegotiationsRepo.java	(revision 6)
+++ /src/main/java/geniusweb/runserver/RunningNegotiationsRepo.java	(revision 7)
@@ -55,5 +55,5 @@
 		}
 		negotiations.put(entity.getID(), entity);
-		notifyChange(entity.getID());
+		notifyListeners(entity.getID());
 		log.log(Level.FINEST, "started " + entity.getID());
 	}
@@ -62,5 +62,5 @@
 	public void remove(String id) {
 		negotiations.remove(id);
-		notifyChange(id);
+		notifyListeners(id);
 		log.log(Level.FINEST, "stopped negotiation " + id);
 	}
@@ -73,5 +73,5 @@
 		}
 		negotiations.put(entity.getID(), entity);
-		notifyChange(entity.getID());
+		notifyListeners(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 7)
+++ /src/main/java/geniusweb/runserver/WebSocketProtToPartyConn.java	(revision 7)
@@ -0,0 +1,257 @@
+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.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 {
+	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 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();
+		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.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);
+		this.session = session;
+	}
+
+	@OnClose
+	public void onClose(Session userSession, CloseReason reason) {
+		log.log(Level.INFO, "closing websocket " + reference + ":" + reason);
+		if (reason.getReasonPhrase() != null) {
+			setError(new RemoteException("Session " + reference
+					+ " closed abnoramlly (see party server for more details) "
+					+ reason.getReasonPhrase()));
+			return;
+		}
+		setError(new SocketException("socket has been closed"));
+	}
+
+	@OnMessage
+	public void processMessage(String message) {
+		try {
+			Action act = jackson.readValue(message, 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);
+
+	}
+}
Index: /src/main/webapp/newsession.xhtml
===================================================================
--- /src/main/webapp/newsession.xhtml	(revision 6)
+++ /src/main/webapp/newsession.xhtml	(revision 7)
@@ -27,5 +27,5 @@
 	<br /> Domain/Profile Server:
 	<input type="url" name="url" id="profilesserverurl"
-		value="localhost:8080/profilesserver-1.0.0"
+		value="localhost:8080/profilesserver-1.1.0"
 		pattern=".*:[0-9]+/profilesserver" size="30"
 		onchange="connectDomain()"> </input>
@@ -41,5 +41,5 @@
 		<br /> <b>Participants</b> <br /> Parties Server: <input type="url"
 			name="url" id="partiesserverurl"
-			value="localhost:8080/partiesserver-1.0.0"
+			value="localhost:8080/partiesserver-1.1.0"
 			pattern=".*:[0-9]+/partiesserver" size="30"
 			onchange="connectParties()"> </input> <br /> <br /> <b>Edit
@@ -220,8 +220,8 @@
 	 refresh table: copy all parties elements in there.
 	 Typically parties is something like
-	 [{"uri":"http:130.161.180.1:8080/partiesserver/run/randomparty-1.0.0",
+	 [{"uri":"http:130.161.180.1:8080/partiesserver/run/randomparty-1.1.0",
 		 "capabilities":{"protocols":["SAOP"]},
 		 "description":"places random bids until it can accept an offer with utility >0.6",
-		 "id":"randomparty-1.0.0",
+		 "id":"randomparty-1.1.0",
 		 "partyClass":"geniusweb.exampleparties.randomparty.RandomParty"},
 		 		 ...]
@@ -396,6 +396,6 @@
 	*/
 	function init() {
-		document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1.0.0"
-		document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1.0.0"
+		document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1.1.0"
+		document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1.1.0"
 		connectDomain();
 		connectParties();
Index: /src/main/webapp/newtournament.xhtml
===================================================================
--- /src/main/webapp/newtournament.xhtml	(revision 6)
+++ /src/main/webapp/newtournament.xhtml	(revision 7)
@@ -43,5 +43,5 @@
 	<div id="box" class="box">
 		<br /> Domain/Profile Server: <input type="url" name="url"
-			id="profilesserverurl" value="localhost:8080/profilesserver-1.0.0"
+			id="profilesserverurl" value="localhost:8080/profilesserver-1.1.0"
 			pattern=".*:[0-9]+/profilesserver" size="30"
 			onchange="connectDomain()"> </input> <br /> Domain: <select
@@ -69,5 +69,5 @@
 	<div id="box" class="box">
 		<br /> Parties Server: <input type="url" name="url"
-			id="partiesserverurl" value="localhost:8080/partiesserver-1.0.0"
+			id="partiesserverurl" value="localhost:8080/partiesserver-1.1.0"
 			pattern=".*:[0-9]+/partiesserver" size="30"
 			onchange="connectParties()"> </input> <br /> <br />
@@ -390,6 +390,6 @@
 	*/
 	function init() {
-		document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1.0.0"
-		document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1.0.0"
+		document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1.1.0"
+		document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1.1.0"
 
 
