}
private static ByteBuffer wrapInHttpResponse(ByteBuffer pkt) throws IOException {
byte[] b = new byte[pkt.remaining()];
pkt.get(b, 0, pkt.remaining());
HTTPResponse response = wrapInHttp(b);
ByteArrayOutputStream out = new ByteArrayOutputStream();
response.writeTo(out);
return ByteBuffer.wrap(out.toByteArray());
}