Code example for Socket

Methods: connect

0
        } 
    } 
 
    public void test_connect() throws Exception { 
        StuckServer ss = new StuckServer();
        Socket s = new Socket();
        new Killer(s).start();
        try { 
            System.err.println("connect...");
            s.connect(ss.getLocalSocketAddress());
            fail("connect returned!");
        } catch (SocketException expected) {
            assertEquals("Socket closed", expected.getMessage());
        } finally { 
            ss.close();
        } 
    } 
 
    public void test_connect_timeout() throws Exception { 
        StuckServer ss = new StuckServer();
        Socket s = new Socket();