HttpEntity entity = null;
// Prepare requests for each thread
if (config.getPayloadFile() != null) {
entity = new FileEntity(config.getPayloadFile(), config.getContentType());
((FileEntity) entity).setChunked(config.isUseChunking());
contentLength = config.getPayloadFile().length();
} else if (config.getPayloadText() != null) {
entity = new StringEntity(config.getPayloadText(), config.getContentType(), "UTF-8");