Почему программа не завершает работу, а остаётся зависшей?
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.net.Socket;
public class NewMain {
/**
* @param args the command line arguments
*/
public static String tmpStr;
static StringBuffer tmpBuff = new StringBuffer();
public static String string;
public static void main(String[] args) throws Exception {
// TODO code application logic here
Socket s = new Socket("pop.yandex.ru", 110);
s.getOutputStream().write("USER thisisforjava".getBytes("iso-8859-1"));
BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream(), "iso-8859-1"));
while (true) {
String line = br.readLine();
if (!line.startsWith("+OK")) break;
System.out.println(line);
}
br.close();
s.close();
}
}