public static byte[] toByteArray(final InputStream inputStream) throws IOException {
        final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        int nRead;
        byte[] data = new byte[4096];
        while ((nRead = inputStream.read(data, 0, data.length)) != -1) {
            buffer.write(data, 0, nRead);
        }
        return buffer.toByteArray();
    }
@param inputStream streams are closed by the caller
agent-module/plugins-test-module/plugins-test/src/main/java/com/navercorp/pinpoint/test/plugin/util/IOUtils.java