@@ -118,19 +118,40 @@ public class AsyncHttpClient {
118
118
119
119
120
120
/**
121
- * Creates a new AsyncHttpClient.
121
+ * Creates a new AsyncHttpClient with default constructor arguments values
122
122
*/
123
123
public AsyncHttpClient () {
124
- this (false );
124
+ this (false , 80 , 443 );
125
+ }
126
+
127
+ /**
128
+ * Creates a new AsyncHttpClient.
129
+ *
130
+ * @param httpPort non-standard HTTP-only port
131
+ */
132
+ public AsyncHttpClient (int httpPort ) {
133
+ this (false , httpPort , 443 );
134
+ }
135
+
136
+ /**
137
+ * Creates a new AsyncHttpClient.
138
+ *
139
+ * @param httpPort non-standard HTTP-only port
140
+ * @param httpsPort non-standard HTTPS-only port
141
+ */
142
+ public AsyncHttpClient (int httpPort , int httpsPort ) {
143
+ this (false , httpPort , httpsPort );
125
144
}
126
145
127
146
/**
128
147
* Creates a new AsyncHttpClient.
129
148
*
130
149
* @param fixNoHttpResponseException See issue https://github.com/loopj/android-async-http/issues/143
150
+ * @param httpPort non-standard HTTP-only port
151
+ * @param httpsPort non-standard HTTPS-only port
131
152
*/
132
- public AsyncHttpClient (boolean fixNoHttpResponseException ) {
133
- if (fixNoHttpResponseException )
153
+ public AsyncHttpClient (boolean fixNoHttpResponseException , int httpPort , int httpsPort ) {
154
+ if (fixNoHttpResponseException )
134
155
Log .d (LOG_TAG , "Beware! Using the fix is insecure, as it doesn't verify SSL certificates." );
135
156
BasicHttpParams httpParams = new BasicHttpParams ();
136
157
@@ -155,8 +176,8 @@ public AsyncHttpClient(boolean fixNoHttpResponseException) {
155
176
sslSocketFactory = SSLSocketFactory .getSocketFactory ();
156
177
157
178
SchemeRegistry schemeRegistry = new SchemeRegistry ();
158
- schemeRegistry .register (new Scheme ("http" , PlainSocketFactory .getSocketFactory (), 80 ));
159
- schemeRegistry .register (new Scheme ("https" , sslSocketFactory , 443 ));
179
+ schemeRegistry .register (new Scheme ("http" , PlainSocketFactory .getSocketFactory (), httpPort ));
180
+ schemeRegistry .register (new Scheme ("https" , sslSocketFactory , httpsPort ));
160
181
161
182
ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager (httpParams , schemeRegistry );
162
183
0 commit comments