public byte[] toBytes()
	{
		ByteArrayOutputStream baos = null;
		DataOutputStream dos = null;
	
		try {
			baos = new ByteArrayOutputStream();
			dos = new DataOutputStream(baos);
			try {
				dos.write(Constant.MAGIC_NUMBER);
				byte[] content = request.toBytes();
				dos.writeShort((short) (content.length + 2));
				dos.writeShort(request.getId().shortValue());
				dos.write(content);
				dos.flush();
			} catch (IOException e) {
				e.printStackTrace();
			}
			
			return baos.toByteArray();
		} catch (Exception e) {
			e.printStackTrace();
			return new byte[0];
		} finally {
			try {
				if (null != baos) baos.close();
				if (null != dos) dos.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}