Package javax.net

Examples of javax.net.ServerSocketFactory.createServerSocket()


            System.setProperty("javax.net.ssl.trustStore", path);
            System.setProperty("javax.net.ssl.trustStorePassword", password);

            ServerSocketFactory server = SSLServerSocketFactory.getDefault();
            // Let the operating system just choose an available port:
            ServerSocket serverSocket = server.createServerSocket(0);
            serverSocket.setSoTimeout(30000);
            int port = serverSocket.getLocalPort();
            // System.out.println("\nlistening on port: " + port);

            SSLSocketFactory ssf = SSLSocketFactory.getSocketFactory();
View Full Code Here


        super();
    }
   
    public ServerSocket createServerSocket(int port) throws IOException {
      ServerSocketFactory socketfactory = getSSLContext().getServerSocketFactory();
        return socketfactory.createServerSocket(port);
    }
   
}
View Full Code Here

        try {
            ss =   (ServerSocket) AccessController.doPrivileged
            (new PrivilegedExceptionAction() {
                public Object run() throws IOException  {
                    ServerSocketFactory sf = ServerSocketFactory.getDefault();
                    return sf.createServerSocket(slaveAddress.getPortNumber(),
                            0, slaveAddress.getHostAddress());
                }
            });
            return ss;
        } catch(PrivilegedActionException pea) {
View Full Code Here

    public ServerSocket createServerSocket(InetAddress address, int port, int backlog, Boolean reuse) throws IOException
    {
        try
        {
            ServerSocketFactory ssf = tls.getServerSocketFactory();
            return configure(ssf.createServerSocket(), reuse, new InetSocketAddress(address, port), backlog);
        }
        catch (IOException e)
        {
            throw e;
        }
View Full Code Here

    public ServerSocket createServerSocket(int port, int backlog, Boolean reuse) throws IOException
    {
        try
        {
            ServerSocketFactory ssf = tls.getServerSocketFactory();
            return configure(ssf.createServerSocket(), reuse, new InetSocketAddress(port), backlog);
        }
        catch (IOException e)
        {
            throw e;
        }
View Full Code Here

      ServerSocketFactory factory = getServerSocketFactory();
      ServerSocket ss = null;
     
      try
      {
         ss = factory.createServerSocket();
      }
      catch (SocketException e)
      {
         if (getReuseAddress())
            log.warn("Unable to create unbound ServerSocket: cannot set reuseAddress to true",e);
View Full Code Here

      catch (SocketException e)
      {
         if (getReuseAddress())
            log.warn("Unable to create unbound ServerSocket: cannot set reuseAddress to true",e);
         ss = factory.createServerSocket(serverBindPort, backlog, bindAddress);
         configureServerSocket(ss);
         return ss;
      }
     
      ss.setReuseAddress(getReuseAddress());
View Full Code Here

         InetAddress inetAddress = getAddressByName(home.host);
        
         ServerSocket ss = null;
         try
         {
            ss = factory.createServerSocket();
            ss.setReuseAddress(getReuseAddress());
            configureServerSocket(ss);
            InetSocketAddress address = new InetSocketAddress(inetAddress, home.port);
            bind(ss, address, backlog);
            if (log.isDebugEnabled()) log.debug(this + " created " + ss);
View Full Code Here

            if (getReuseAddress())
               log.warn("Unable to create unbound ServerSocket: cannot set reuseAddress to true");

            try
            {
               ss = factory.createServerSocket(home.port, backlog, inetAddress);
               configureServerSocket(ss);
            }
            catch (IOException e2)
            {
               String m = this + " error creating ServerSocket[" + home + "]: " + e2.getMessage();
View Full Code Here

    public static MongodExecutable prepareExecutable() throws IOException {
        int port = 27017;
        try {
            final ServerSocketFactory socketFactory = ServerSocketFactory.getDefault();
            ServerSocket socket = socketFactory.createServerSocket(port);
            socket.close();
            if (!socket.isClosed()) {
                logger.warn("Didn't manage to close socket for some reason. Tests may start failing...");
            }
        } catch (IOException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.