Skip to content

Commit

Permalink
Merge pull request koush#7 from mike-stewart/master
Browse files Browse the repository at this point in the history
Create an SSL socket for https connections.
  • Loading branch information
koush committed Feb 5, 2013
2 parents 8c8bf39 + 86617e5 commit e683f20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/com/codebutler/android_websockets/WebSocketClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void connect() {
@Override
public void run() {
try {
int port = (mURI.getPort() != -1) ? mURI.getPort() : (mURI.getScheme().equals("wss") ? 443 : 80);
int port = (mURI.getPort() != -1) ? mURI.getPort() : ((mURI.getScheme().equals("wss") || mURI.getScheme().equals("https")) ? 443 : 80);

String path = TextUtils.isEmpty(mURI.getPath()) ? "/" : mURI.getPath();
if (!TextUtils.isEmpty(mURI.getQuery())) {
Expand All @@ -79,7 +79,7 @@ public void run() {
String originScheme = mURI.getScheme().equals("wss") ? "https" : "http";
URI origin = new URI(originScheme, "//" + mURI.getHost(), null);

SocketFactory factory = mURI.getScheme().equals("wss") ? getSSLSocketFactory() : SocketFactory.getDefault();
SocketFactory factory = (mURI.getScheme().equals("wss") || mURI.getScheme().equals("https")) ? getSSLSocketFactory() : SocketFactory.getDefault();
mSocket = factory.createSocket(mURI.getHost(), port);

PrintWriter out = new PrintWriter(mSocket.getOutputStream());
Expand Down

0 comments on commit e683f20

Please sign in to comment.