public byte[] toBytes() throws UnsupportedEncodingException {
		byte[] body = res.toString().getBytes(charset);
		header.put(HttpHeader.CONTENT_LENGTH,
				((Integer) body.length).toString());

		if (!header.containsKey(HttpHeader.HEAD_CONTENT_TYPE)) {
			header.put(HttpHeader.HEAD_CONTENT_TYPE, "text/html");
		}

		StringBuilder sb = new StringBuilder();
		switch (this.statusCode) {
		case 200:
			sb.append(HttpVersion.VERSION + " 200 OK\r\n");
			break;
		case 302:
			sb.append(HttpVersion.VERSION + " 302 Moved \r\n");
			break;
		case 500:
			sb.append(HttpVersion.VERSION + " 500 INTERNAL SERVER ERROR\r\n");
			break;
		}

		Iterator<Map.Entry<String, String>> it = header.entrySet().iterator();
		while (it.hasNext()) {
			Map.Entry<String, String> entry = it.next();
			sb.append(entry.getKey() + ": " + entry.getValue() + "\r\n");
		}
		sb.append("\r\n");

		byte[] head = sb.toString().getBytes(charset);
		byte[] pacaket = new byte[head.length + body.length];
		System.arraycopy(head, 0, pacaket, 0, head.length);
		System.arraycopy(body, 0, pacaket, head.length, body.length);

		return pacaket;
	}