| | |
| | |
|
| | | /**
|
| | | * Utility class for establishing HTTP/HTTPS connections.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | * |
| | | *
|
| | | */
|
| | | public class ConnectionUtils {
|
| | |
|
| | |
| | | SSL_CONTEXT = context;
|
| | | HOSTNAME_VERIFIER = new DummyHostnameVerifier();
|
| | | CHARSET = "UTF-8";
|
| | | |
| | |
|
| | | // Disable Java 7 SNI checks
|
| | | // http://stackoverflow.com/questions/7615645/ssl-handshake-alert-unrecognized-name-error-since-upgrade-to-java-1-7-0
|
| | | System.setProperty("jsse.enableSNIExtension", "false");
|
| | |
| | | }
|
| | | return conn;
|
| | | }
|
| | | |
| | |
|
| | | // Copyright (C) 2009 The Android Open Source Project
|
| | | //
|
| | | // Licensed under the Apache License, Version 2.0 (the "License");
|
| | |
| | |
|
| | | /**
|
| | | * DummyTrustManager trusts all certificates.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | */
|
| | | private static class DummyTrustManager implements X509TrustManager {
|
| | |
| | |
|
| | | /**
|
| | | * Trusts all hostnames from a certificate, including self-signed certs.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | */
|
| | | private static class DummyHostnameVerifier implements HostnameVerifier {
|