}
public void start(Buffer buf) {
isReady = false;
IniProperties cfg = SnovaConfiguration.getInstance().getIniProperties();
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1,
HttpMethod.POST, serv.server.url.toString() + "push");
String enc = cfg.getProperty("C4", "Encrypter", "RC4");
if (enc.equalsIgnoreCase("RC4")) {
String key = cfg.getProperty("Misc", "RC4Key");
RC4.setDefaultKey(key);
byte[] tmp = RC4.encrypt(key.getBytes());
request.setHeader("RC4Key", Base64.encodeToString(tmp, false));
}
request.setHeader(HttpHeaders.Names.HOST, serv.server.url.getHost());
request.setHeader(HttpHeaders.Names.CONNECTION, "keep-alive");
request.setHeader("UserToken", NetworkHelper.getMacAddress());
request.setHeader("C4MiscInfo", String.format("%d_%d", index, 25));
request.setHeader(
HttpHeaders.Names.USER_AGENT,
cfg.getProperty("C4", "UserAgent",
"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/19.0.1"));
request.setHeader(HttpHeaders.Names.CONTENT_TYPE,
"application/octet-stream");
request.setHeader(HttpHeaders.Names.CONTENT_LENGTH, buf.readableBytes());
request.setContent(ChannelBuffers.wrappedBuffer(buf.getRawBuffer(),
buf.getReadIndex(), buf.readableBytes()));
HttpClient client = HttpTunnelService.httpClient;
try {
client.execute(request, new HttpClientFutureCallback(buf));
} catch (HttpClientException e) {