List of usage examples for javax.net.ssl SSLServerSocketFactory createServerSocket
@Override public ServerSocket createServerSocket(int port, int backlog) throws IOException
From source file:net.lightbody.bmp.proxy.jetty.http.JsseListener.java
/** * @param p_address/*from ww w . j a va 2 s. com*/ * @param p_acceptQueueSize * @return * @exception IOException */ protected ServerSocket newServerSocket(InetAddrPort p_address, int p_acceptQueueSize) throws IOException { SSLServerSocketFactory factory = null; SSLServerSocket socket = null; try { factory = createFactory(); if (p_address == null) { socket = (SSLServerSocket) factory.createServerSocket(0, p_acceptQueueSize); } else { socket = (SSLServerSocket) factory.createServerSocket(p_address.getPort(), p_acceptQueueSize, p_address.getInetAddress()); } socket.setNeedClientAuth(_needClientAuth); log.info("JsseListener.needClientAuth=" + _needClientAuth); } catch (IOException e) { throw e; } catch (Exception e) { log.warn(LogSupport.EXCEPTION, e); throw new IOException("Could not create JsseListener: " + e.toString()); } return socket; }
From source file:net.lightbody.bmp.proxy.jetty.http.SslListener.java
/** * @param p_address/*from www.j a v a 2 s . c o m*/ * @param p_acceptQueueSize * @return @exception IOException */ protected ServerSocket newServerSocket(InetAddrPort p_address, int p_acceptQueueSize) throws IOException { SSLServerSocketFactory factory = null; SSLServerSocket socket = null; try { factory = createFactory(); if (p_address == null) { socket = (SSLServerSocket) factory.createServerSocket(0, p_acceptQueueSize); } else { socket = (SSLServerSocket) factory.createServerSocket(p_address.getPort(), p_acceptQueueSize, p_address.getInetAddress()); } if (_needClientAuth) socket.setNeedClientAuth(true); else if (_wantClientAuth) socket.setWantClientAuth(true); if (cipherSuites != null && cipherSuites.length > 0) { socket.setEnabledCipherSuites(cipherSuites); for (int i = 0; i < cipherSuites.length; i++) { log.debug("SslListener enabled ciphersuite: " + cipherSuites[i]); } } } catch (IOException e) { throw e; } catch (Exception e) { log.warn(LogSupport.EXCEPTION, e); throw new IOException("Could not create JsseListener: " + e.toString()); } return socket; }
From source file:org.apache.ftpserver.ssl.Ssl.java
/** * Create secure server socket.//from www . j av a 2 s .com */ public ServerSocket createServerSocket(String protocol, InetAddress addr, int port) throws Exception { // get server socket factory SSLContext ctx = getSSLContext(protocol); SSLServerSocketFactory ssocketFactory = ctx.getServerSocketFactory(); // create server socket SSLServerSocket serverSocket = null; if (addr == null) { serverSocket = (SSLServerSocket) ssocketFactory.createServerSocket(port, 100); } else { serverSocket = (SSLServerSocket) ssocketFactory.createServerSocket(port, 100, addr); } // initialize server socket String cipherSuites[] = serverSocket.getSupportedCipherSuites(); serverSocket.setEnabledCipherSuites(cipherSuites); serverSocket.setNeedClientAuth(m_clientAuthReqd); return serverSocket; }
From source file:org.openqa.jetty.http.JsseListener.java
/** * @param p_address/* w ww.j a va 2 s.c o m*/ * @param p_acceptQueueSize * @return A ServerSocket object using the passed parameters to set it up * from an SSLServerSocketFactory. * @exception IOException */ @Override protected ServerSocket newServerSocket(InetAddrPort p_address, int p_acceptQueueSize) throws IOException { SSLServerSocketFactory factory = null; SSLServerSocket socket = null; try { factory = createFactory(); if (p_address == null) { socket = (SSLServerSocket) factory.createServerSocket(0, p_acceptQueueSize); } else { socket = (SSLServerSocket) factory.createServerSocket(p_address.getPort(), p_acceptQueueSize, p_address.getInetAddress()); } socket.setNeedClientAuth(_needClientAuth); log.info("JsseListener.needClientAuth=" + _needClientAuth); } catch (IOException e) { throw e; } catch (Exception e) { log.warn(LogSupport.EXCEPTION, e); throw new IOException("Could not create JsseListener: " + e.toString()); } return socket; }