@@ -61,37 +61,37 @@ public class FunPayExecutor {
6161
6262 @ NonNull protected final FunPayClient funPayClient ;
6363
64- /** Creates a new FunPayExecutor instance */
65- public FunPayExecutor () {
66- OkHttpClient httpClient = new OkHttpClient ();
67-
68- this .funPayParser = new JsoupFunPayParser (httpClient , FunPayURL .BASE_URL );
69- this .funPayClient = new OkHttpFunPayClient (httpClient , FunPayURL .BASE_URL );
70- }
71-
7264 /**
7365 * Creates a new FunPayExecutor instance
7466 *
7567 * @param baseURL base URL of the primary server
7668 * @param proxy proxy for forwarding requests
7769 */
78- public FunPayExecutor (@ NonNull String baseURL , @ NonNull Proxy proxy ) {
79- OkHttpClient httpClient = new OkHttpClient .Builder ().proxy (proxy ).build ();
70+ public FunPayExecutor (@ NonNull String baseURL , Proxy proxy ) {
71+ OkHttpClient httpClient ;
72+
73+ if (proxy == null ) {
74+ httpClient = new OkHttpClient ();
75+ } else {
76+ httpClient = new OkHttpClient .Builder ().proxy (proxy ).build ();
77+ }
8078
8179 this .funPayParser = new JsoupFunPayParser (httpClient , baseURL );
8280 this .funPayClient = new OkHttpFunPayClient (httpClient , baseURL );
8381 }
8482
83+ /** Creates a new FunPayExecutor instance */
84+ public FunPayExecutor () {
85+ this (FunPayURL .BASE_URL , null );
86+ }
87+
8588 /**
8689 * Creates a new FunPayExecutor instance
8790 *
8891 * @param baseURL base URL of the primary server
8992 */
9093 public FunPayExecutor (@ NonNull String baseURL ) {
91- OkHttpClient httpClient = new OkHttpClient ();
92-
93- this .funPayParser = new JsoupFunPayParser (httpClient , baseURL );
94- this .funPayClient = new OkHttpFunPayClient (httpClient , baseURL );
94+ this (baseURL , null );
9595 }
9696
9797 /**
@@ -100,10 +100,7 @@ public FunPayExecutor(@NonNull String baseURL) {
100100 * @param proxy proxy for forwarding requests
101101 */
102102 public FunPayExecutor (@ NonNull Proxy proxy ) {
103- OkHttpClient httpClient = new OkHttpClient .Builder ().proxy (proxy ).build ();
104-
105- this .funPayParser = new JsoupFunPayParser (httpClient , FunPayURL .BASE_URL );
106- this .funPayClient = new OkHttpFunPayClient (httpClient , FunPayURL .BASE_URL );
103+ this (FunPayURL .BASE_URL , proxy );
107104 }
108105
109106 /**
0 commit comments