@Override
	public byte[] getBytes() {
		ByteArrayOutputStream b = new ByteArrayOutputStream();

		try {
			b.write(getMessageFactory().createVariableLengthIntegerMessage(encoding.getConstant()).getBytes());

			switch (encoding) {
			case IGNORE:
				break;

			case TRIVIAL:
				data = content.getBytes("UTF-8");
				break;

			case SIMPLE:
				data = ("Subject:" + subject + "\nBody:" + content).getBytes();
				break;

			default:
				LOG.log(Level.SEVERE, "Unknown encoding: " + encoding);
				System.exit(1);
			}

			b.write(getMessageFactory().createVariableLengthIntegerMessage(data.length).getBytes());
			b.write(data);
		} catch (UnsupportedEncodingException e) {
			LOG.log(Level.SEVERE, "UTF-8 not supported!", e);
			System.exit(1);
		} catch (IOException e) {
			LOG.log(Level.SEVERE, "Could not write bytes!", e);
			System.exit(1);
		}

		return b.toByteArray();
	}