Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix for #186 #188

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/main/java/com/notnoop/apns/internal/TlsTunnelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ Socket makeTunnel(String host, int port, String proxyUsername,
ProxyClient client = new ProxyClient();
client.getParams().setParameter("http.useragent", "java-apns");
client.getHostConfiguration().setHost(host, port);
String proxyHost = proxyAddress.getAddress().toString().substring(0, proxyAddress.getAddress().toString().indexOf("/"));
client.getHostConfiguration().setProxy(proxyHost, proxyAddress.getPort());
client.getHostConfiguration().setProxy(proxyAddress.getHostName(), proxyAddress.getPort());


ProxyClient.ConnectResponse response = client.connect();
socket = response.getSocket();
if (socket == null) {
Expand All @@ -103,7 +101,8 @@ Socket makeTunnel(String host, int port, String proxyUsername,
if(method.getStatusLine().toString().matches("HTTP/1\\.\\d 407 Proxy Authentication Required")) {
// Proxy server returned 407. We will now try to connect with auth Header
if(proxyUsername != null && proxyPassword != null) {
socket = AuthenticateProxy(method, client,proxyHost, proxyAddress.getPort(),
socket = AuthenticateProxy(method, client,
proxyAddress.getHostName(), proxyAddress.getPort(),
proxyUsername, proxyPassword);
} else {
throw new ProtocolException("Socket not created: " + method.getStatusLine());
Expand Down