Permalink
Browse files

add support of HTTP Proxy also to ApnsFeedbackConnection

  • Loading branch information...
1 parent feff105 commit 8a00e1ccfa613101aab2fd080cdfaeb4c267473e @zdila zdila committed Mar 21, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/main/java/com/notnoop/apns/internal/ApnsFeedbackConnection.java
@@ -91,13 +91,16 @@ public ApnsFeedbackConnection(final SocketFactory factory, final String host, fi
Socket socket = null;
try {
if (proxy == null) {
- // can only be null: proxySocket = null;
socket = factory.createSocket(host, port);
+ } else if (proxy.type() == Proxy.Type.HTTP) {
+ TlsTunnelBuilder tunnelBuilder = new TlsTunnelBuilder();
+ socket = tunnelBuilder.build((SSLSocketFactory) factory, proxy, host, port);
} else {
proxySocket = new Socket(proxy);
proxySocket.connect(new InetSocketAddress(host, port));
- socket = ((SSLSocketFactory)factory).createSocket(proxySocket, host, port, false);
+ socket = ((SSLSocketFactory) factory).createSocket(proxySocket, host, port, false);
}
+
final InputStream stream = socket.getInputStream();
return Utilities.parseFeedbackStream(stream);
} finally {

0 comments on commit 8a00e1c

Please sign in to comment.