- okhttp3
- 线程池
- 策略设计模式
- 简单工厂设计模式
public static int maxThread=50; private static final String userName="baimsg"; private static final String appName=KEYS.get(2);点击详见
只需要替换 resources 里面的 password.ini 即可
//错误案例
public class FriendsChatDictionary implements DictionarySuper {
private final User user;
private static final HashMap<String, String> headers = new HashMap();
private static final HashMap<String, String> form = new HashMap();
public FriendsChatDictionary(User user) {
this.user = user;
form.put("account", user.getPhone());
form.put("password", user.getPassword());
}
static {
headers.put("Content-Type", "application/x-www-form-urlencoded");
headers.put("Host", "yl0528yl01.cc:51001");
headers.put("Connection", "close");
form.put("os", "android");
form.put("v", "2.2.5");
}
}
//改版代码
public class FriendsChatDictionary implements DictionarySuper {
private final User user;
private static final HashMap<String, String> headers = new HashMap();
public FriendsChatDictionary(User user) {
this.user = user;
}
public User login() {
HashMap<String, String> form = new HashMap();
form.put("os", "android");
form.put("v", "2.2.5");
form.put("account", user.getPhone());
form.put("password", user.getPassword());
return this.user;
}
static {
headers.put("Content-Type", "application/x-www-form-urlencoded");
headers.put("Connection", "close");
// headers.put("Host", "yl0528yl01.cc:51001");
}
}