private static byte encodeConnectionId(int connectionId) throws ConnectionIdOutOfRangeException {
		if(connectionId != Packet.ANONYMOUS_CONNECTION_ID && (connectionId < Packet.MINIMUM_CONNECTION_ID || connectionId > Packet.MAXIMUM_CONNECTION_ID))
			throw new ConnectionIdOutOfRangeException(connectionId);
		return (byte) (connectionId > Byte.MAX_VALUE ? connectionId + 2*Byte.MIN_VALUE : connectionId);
	}