Code example for SSLSocket

Methods: getEnabledProtocols, setEnabledProtocols

0
     * javax.net.ssl.SSLSocket#setEnabledProtocols(String[] protocols) 
     */ 
    public void test_EnabledProtocols() throws IOException { 
        SSLSocket ssl = getSSLSocket();
        try { 
            ssl.setEnabledProtocols(null);
            fail();
        } catch (IllegalArgumentException expected) {
        } 
        ssl.setEnabledProtocols(new String[] {});
        try { 
            ssl.setEnabledProtocols(new String[] {"blubb"});
            fail();
        } catch (IllegalArgumentException expected) {
        } 
        ssl.setEnabledProtocols(ssl.getEnabledProtocols());
        String[] res = ssl.getEnabledProtocols();
        assertEquals("no enabled protocols set",
                     ssl.getEnabledProtocols().length, res.length);
        ssl.close();
    } 
 
    /** 
     * javax.net.ssl.SSLSocket#getSession()