extract interfaces to improve testability
[teamcity/dotNetPackagesSupport.git] / nuget-server / src / jetbrains / buildServer / nuget / server / feed / reader / impl / FeedClient.java
index e426130619a7f7a1cfc924b86105be8ff9eb915b..629e37426b7a3d0761691c17a87ddf2c6ecfa967 100644 (file)
 \r
 package jetbrains.buildServer.nuget.server.feed.reader.impl;\r
 \r
-import jetbrains.buildServer.version.ServerVersionHolder;\r
 import org.apache.http.client.HttpClient;\r
-import org.apache.http.impl.client.DefaultHttpClient;\r
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;\r
-import org.apache.http.params.HttpConnectionParams;\r
-import org.apache.http.params.HttpParams;\r
-import org.apache.http.params.HttpProtocolParams;\r
 import org.jetbrains.annotations.NotNull;\r
 \r
 /**\r
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
- * Date: 11.08.11 16:24\r
+ * Date: 12.08.11 15:13\r
  */\r
-public class FeedClient {\r
-  private final HttpClient myClient;\r
-\r
-  public FeedClient() {\r
-    myClient = new DefaultHttpClient(new ThreadSafeClientConnManager());\r
-    final HttpParams params = myClient.getParams();\r
-\r
-    HttpConnectionParams.setConnectionTimeout(params, 10000);\r
-    HttpConnectionParams.setSoTimeout(params, 10000);\r
-\r
-    final String serverVersion = ServerVersionHolder.getVersion().getDisplayVersion();\r
-    HttpProtocolParams.setUserAgent(params, "JetBrains TeamCity " + serverVersion);\r
-  }\r
-\r
+public interface FeedClient {\r
   @NotNull\r
-  public HttpClient getClient() {\r
-    return myClient;\r
-  }\r
-\r
-  public void dispose() {\r
-    myClient.getConnectionManager().shutdown();\r
-  }\r
-\r
+  HttpClient getClient();\r
 }\r