All pastes #408465 Raw Edit

Something

public java v1 · immutable
#408465 ·published 2007-03-24 21:17 UTC
rendered paste body
import java.io.*;import java.net.*;public class Test {  Socket socket;  BufferedReader in;  PrintWriter out;  public Test() {    try {      socket = new Socket("www.google.com", 80);      System.out.println("Connected to host");      in = new BufferedReader(new InputStreamReader(socket.getInputStream()));      out = new PrintWriter(socket.getOutputStream(), true);      out.println("GET / HTTP/1.1");      System.out.println("Request sent");      String line;      while ( (line = in.readLine()) != null)        System.out.println(line);      socket.close();    } catch(UnknownHostException e) {}    catch(IOException e) {}  }  public static void main(String[] args) {    Test test = new Test();  }}