* @return T
*/
public static <T> T parse(byte[] data, Class<? extends Request<T>> classType) {
Type[] types = doResolveTypeArguments(classType, classType, Request.class);
if (types == null || types.length == 0) {
throw new ParseException("Request<T> was not found for " + classType);
}
Type type = types[0];
try {
return Holder.parser.parse(data, type);
} catch (RuntimeException e) {
String json = HttpUtil.getUTF8String(data);
throw new ParseException("Failed to parse JSON:" + json, e);
}
}