try { Socket s = new Socket("metalab.unc.edu", 80); OutputStream out = s.getOutputStream(); out.close(); InputStream in = s.getInputStream(); } catch (IOException e) { System.err.println(e); }