public ByteBuffer processOutgoing(ByteBuffer b) {
		if(b.remaining() > maxSizeContents)
			throw new IllegalArgumentException("Cannot write out packets larger than size="+maxSizeContents);
		ByteBuffer readOnlyTail = ByteBuffer.wrap(packetSeparator).asReadOnlyBuffer();

		int seq = getSequence();

		if(log.isLoggable(Level.FINER))
			log.finer(id+"packetized-> #"+seq+" buf="+b);
		
		ByteBuffer packet = ByteBuffer.allocate(b.remaining()+readOnlyTail.remaining()+HEADER_SIZE);
		int size = b.remaining();
		packet.putInt(seq);
		packet.putInt(size);
		packet.put(b);
		packet.put(readOnlyTail);
		HELPER.doneFillingBuffer(packet);
		
		return packet;
	}