private Network createNetwork(IBasicRequest request) throws Exception {
  request.onPreExecute();
  String url=request.url();
  Logger.i("Request address: " + url);
  Logger.i("Request method: " + request.getRequestMethod());
  Headers headers=request.headers();
  headers.set(Headers.HEAD_KEY_CONTENT_TYPE,request.getContentType());
  List<String> values=headers.getValues(Headers.HEAD_KEY_CONNECTION);
  if (values == null || values.size() == 0)   headers.add(Headers.HEAD_KEY_CONNECTION,Headers.HEAD_VALUE_CONNECTION_KEEP_ALIVE);
  RequestMethod requestMethod=request.getRequestMethod();
  if (requestMethod.allowRequestBody())   headers.set(Headers.HEAD_KEY_CONTENT_LENGTH,Long.toString(request.getContentLength()));
  headers.addCookie(new URI(url),NoHttp.getCookieManager());
  return mExecutor.execute(request);
}

private Network createNetwork ( IBasicRequest request ) throws Exception { request . onPreExecute ( ) ; String url = request . url ( ) ; Logger . i ( "Request address: " + url ) ; Logger . i ( "Request method: " + request . getRequestMethod ( ) ) ; Headers headers = request . headers ( ) ; headers . set ( Headers . HEAD_KEY_CONTENT_TYPE , request . getContentType ( ) ) ; List < String > values = headers . getValues ( Headers . HEAD_KEY_CONNECTION ) ; if ( values == null || values . size ( ) == 0 ) headers . add ( Headers . HEAD_KEY_CONNECTION , Headers . HEAD_VALUE_CONNECTION_KEEP_ALIVE ) ; RequestMethod requestMethod = request . getRequestMethod ( ) ; if ( requestMethod . allowRequestBody ( ) ) headers . set ( Headers . HEAD_KEY_CONTENT_LENGTH , Long . toString ( request . getContentLength ( ) ) ) ; headers . addCookie ( new URI ( url ) , NoHttp . getCookieManager ( ) ) ; return mExecutor . execute ( request ) ; }
the connection is established , including the head and send the request body .
