Tak chyba byla jinde.
A to v tom, jak jsem postupně otevíral spojení.
Kdyby to někomu pomohlo, funkce odzkoušená vypadá takto:
private ArrayList<String> Update(final String urlString, String login, String password)
{
String response2 = "";
OutputStream os = null;
InputStream is = null;
HttpURLConnection conn = null;
mujString = new ArrayList<>();
int resCode = 0;
try {
URL url = new URL(urlString);
conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000);
conn.setConnectTimeout(15000);
conn.setRequestMethod("POST");
conn.setDoInput(true);
conn.setDoOutput(true);
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("login", login));
params.add(new BasicNameValuePair("password", password));
//params.add(new BasicNameValuePair("thirdParam", paramValue3));
os = conn.getOutputStream();
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
writer.write(getQuery(params));
writer.flush();
writer.close();
os.close();
resCode = conn.getResponseCode();
String line;
BufferedReader br=new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((line=br.readLine()) != null) {
response2 += line;
}
//mujString.add(String.valueOf(resCode));
//mujString.add(response2);
}
catch (Exception ex) {
}
finally {
conn.disconnect();
}
mujString.add(String.valueOf(resCode));
mujString.add(response2);
return mujString;
}