As I wrote in my comment, check that the server (something like EchoServer?) Is up and running.
But there are other problems when you can connect. pw.println(stdIn.nextLine());may not send content to the server, you need to do pw.flush();to really send the content, or you can create your own PrintWriterusing autorun:
pw = new PrintWriter(clientOut, true);
EchoServer, , , , :
public class EchoServer {
public static void main(String[] args) throws IOException {
ServerSocket ss = new ServerSocket(1234);
while (true) {
Socket s = ss.accept();
try {
Scanner in = new Scanner(s.getInputStream());
PrintWriter out = new PrintWriter(s.getOutputStream(), true);
String line;
while ((line = in.nextLine()) != null)
out.println(line);
} catch (Exception e) {
e.printStackTrace();
} finally {
s.close();
}
}
}
}
telnet localhost 1234.