Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

Commit

Permalink
Remove connection listener
Browse files Browse the repository at this point in the history
  • Loading branch information
Dino Kovač committed Feb 13, 2016
1 parent efdeb11 commit 3d626cb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
10 changes: 0 additions & 10 deletions httpizza/src/main/java/sexy/code/ConnectionListener.java

This file was deleted.

8 changes: 1 addition & 7 deletions httpizza/src/main/java/sexy/code/HttPizza.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ public class HttPizza {

private final HttpConfig httpConfig;

private ConnectionListener connectionListener;

HttPizza(HttpConfig config) {
this.httpConfig = config;
}
Expand All @@ -16,12 +14,8 @@ public HttPizza() {
this(new HttpConfig());
}

public void setConnectionListener(final ConnectionListener listener) {
connectionListener = listener;
}

public Call newCall(final Request request) {
return new Call(new HttpEngine(httpConfig, connectionListener), request);
return new Call(new HttpEngine(httpConfig), request);
}

public Request.Builder newRequest() {
Expand Down
13 changes: 1 addition & 12 deletions httpizza/src/main/java/sexy/code/HttpEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ class HttpEngine {

private final HttpConfig config;

private final ConnectionListener connectionListener;

HttpEngine(final HttpConfig config, final ConnectionListener l) {
HttpEngine(final HttpConfig config) {
this.config = config;
this.connectionListener = l;
}

public Response execute(final Request request) throws IOException {
Expand All @@ -41,16 +38,8 @@ public Response execute(final Request request) throws IOException {
doOutput(urlConnection, request.getBody());
}

if (connectionListener != null) {
connectionListener.onPreConnect(request, urlConnection);
}

urlConnection.connect();

if (connectionListener != null) {
connectionListener.onPostConnect(request, urlConnection);
}

final int statusCode = urlConnection.getResponseCode();
final String message = urlConnection.getResponseMessage();
final Map<String, List<String>> responseHeaders = urlConnection.getHeaderFields();
Expand Down

0 comments on commit 3d626cb

Please sign in to comment.