@Override
	public Integer read(DataInputStream in, PassthroughConnection ptc, KillableThread thread, boolean serverToClient, DownlinkState linkState) {

		while(true) {
			try {
				value = in.readInt();
				if(serverToClient) {
					if(value == ptc.clientInfo.getPlayerEntityId()) {
						value = Globals.getDefaultPlayerId();
					} else if (value == Globals.getDefaultPlayerId()) {
						ptc.printLogMessage("Player entity id collision (server to client) - breaking connection");
						ptc.printLogMessage("Value: " + value);
						ptc.printLogMessage("Default: " + Globals.getDefaultPlayerId());
						ptc.printLogMessage("Active: " +  ptc.clientInfo.getPlayerEntityId());
						return null;
					} else {
						linkState.entityIds.add(value);
					}
				} else {
					if(value == Globals.getDefaultPlayerId()) {
						value = ptc.clientInfo.getPlayerEntityId();
					} else if (value == ptc.clientInfo.getPlayerEntityId()) {
						ptc.printLogMessage("Player entity id collision (client to server)- breaking connection");
						ptc.printLogMessage("Value: " + value);
						ptc.printLogMessage("Default: " + Globals.getDefaultPlayerId());
						ptc.printLogMessage("Active: " +  ptc.clientInfo.getPlayerEntityId());
						return null;
					}
				}
			} catch ( SocketTimeoutException toe ) {
				if(timedOut(thread)) {
					continue;
				}
				return null;
			} catch (IOException e) {
				return null;
			}

			super.timeout = 0;

			return value;
		}

	}