SSLServerSocket getSupportedCipherSuites - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SSLServerSocket getSupportedCipherSuites method.

This code example shows how to use the following methods:getEnabledCipherSuites, getSupportedCipherSuites, setEnabledCipherSuites
     * javax.net.ssl.SSLServerSocket#setEnabledCipherSuites(String[] suites) 
     */ 
    public void test_EnabledCipherSuites() throws Exception { 
        SSLServerSocket sss = getSSLServerSocket();
        try { 
            sss.setEnabledCipherSuites(null);
        } catch (IllegalArgumentException iae) {
            //expected 
        } 
        String[] unsupportedCipherSuites = {"unsupported"};
        try { 
            sss.setEnabledCipherSuites(unsupportedCipherSuites);
        } catch (IllegalArgumentException iae) {
            //expected 
        } 
        int count = sss.getSupportedCipherSuites().length;
        assertTrue("No supported cipher suites", count > 0);
        sss.setEnabledCipherSuites(sss.getSupportedCipherSuites());
        String[] res = sss.getEnabledCipherSuites();
        assertNotNull("NULL result", res);

7
CodeRank
This code example shows how to use the following methods:setSoTimeout, getSupportedCipherSuites, getSupportedProtocols, setEnabledCipherSuites, setEnabledProtocols
    final SSLServerSocket socket =
      (SSLServerSocket)m_serverSocketFactory.createServerSocket(
        localEndPoint.getPort(), 50,
        InetAddress.getByName(localEndPoint.getHost()));
 
    socket.setSoTimeout(timeout);
 
    socket.setEnabledCipherSuites(socket.getSupportedCipherSuites());
    socket.setEnabledProtocols(socket.getSupportedProtocols());
 
    return socket;
  } 
 
  /** 
   * Factory method for client sockets. 
   * 
   * @param remoteEndPoint Remote host and port. 
   * @return A new <code>Socket</code>. 
   * @exception IOException If an error occurs. 
   */ 
6
CodeRank
This code example shows how to use the following methods:setSoTimeout, getSupportedCipherSuites, getSupportedProtocols, setEnabledCipherSuites, setEnabledProtocols
    final SSLServerSocket socket =
      (SSLServerSocket)m_serverSocketFactory.createServerSocket(
        localEndPoint.getPort(), 50,
        InetAddress.getByName(localEndPoint.getHost()));
 
    socket.setSoTimeout(timeout);
 
    socket.setEnabledCipherSuites(socket.getSupportedCipherSuites());
    socket.setEnabledProtocols(socket.getSupportedProtocols());
 
    return socket;
  } 
 
  /** 
   * Factory method for client sockets. 
   * 
   * @param remoteEndPoint Remote host and port. 
   * @return A new <code>Socket</code>. 
   * @exception IOException If an error occurs. 
   */ 
6
CodeRank
This code example shows how to use the following methods:getSupportedCipherSuites, setEnabledCipherSuites, setNeedClientAuth
	protected void initServerSocket(ServerSocket ssocket, boolean clientAuth) {
 
		SSLServerSocket socket = (SSLServerSocket) ssocket;
 
		// Enable all available cipher suites when the socket is connected 
		String cipherSuites[] = socket.getSupportedCipherSuites();
		socket.setEnabledCipherSuites(cipherSuites);
		// Set client authentication if necessary 
		socket.setNeedClientAuth(clientAuth);
	} 
 
	private String getWithDefault(Map args, String name, String defValue) {
		String result = (String) args.get(name);
		if (result == null)
			return defValue;
		return result;
	} 
} 
5
CodeRank
This code example shows how to use the following methods:setSoTimeout, getSupportedCipherSuites, setEnabledCipherSuites
This code example shows how to use the following methods:getSupportedCipherSuites, setEnabledCipherSuites, setNeedClientAuth
	protected void initServerSocket(ServerSocket ssocket, boolean clientAuth) {
 
		SSLServerSocket socket = (SSLServerSocket) ssocket;
 
		// Enable all available cipher suites when the socket is connected 
		String cipherSuites[] = socket.getSupportedCipherSuites();
		socket.setEnabledCipherSuites(cipherSuites);
		// Set client authentication if necessary 
		socket.setNeedClientAuth(clientAuth);
	} 
 
	private String getWithDefault(Map args, String name, String defValue) {
		String result = (String) args.get(name);
		if (result == null)
			return defValue;
		return result;
	} 
} 
5
CodeRank
This code example shows how to use the following methods:getSupportedCipherSuites
	public int getSoTimeout() throws IOException { 
		return delegate.getSoTimeout();
	} 
 
	public String[] getSupportedCipherSuites() {
		return delegate.getSupportedCipherSuites();
	} 
 
	public String[] getSupportedProtocols() {
		return delegate.getSupportedProtocols();
	} 
 
	public boolean getUseClientMode() { 
		return delegate.getUseClientMode();
	} 
 
	public boolean getWantClientAuth() { 
		return delegate.getWantClientAuth();
	} 
 
5
CodeRank
This code example shows how to use the following methods:getSupportedCipherSuites, setEnabledCipherSuites, setNeedClientAuth
    private void initServerSocket(ServerSocket ssocket) {
 
        SSLServerSocket socket = (SSLServerSocket) ssocket;
 
        // Enable all available cipher suites when the socket is connected 
        String cipherSuites[] = socket.getSupportedCipherSuites();
        socket.setEnabledCipherSuites(cipherSuites);
 
        // Set client authentication if necessary 
        socket.setNeedClientAuth(clientAuth);
 
    } 
 
 
} 
5
CodeRank
getSupportedCipherSuites Method Overview
Returns the names of the supported cipher suites.
See Code Examples for other Java 8 SSLServerSocket Methods: