Examples of ServerSocket


Examples of java.net.ServerSocket

    protected String getProtocol() {
        return "https";
    }

    protected ServerSocket createSocket(int port) throws IOException {
        ServerSocket serverSocket = super.createSocket(port);
        String cipherSuites = CIPHERS_OPTION.getProperty( server, getName() );
        if( cipherSuites != null ) {
            ((SSLServerSocket)serverSocket).setEnabledCipherSuites( cipherSuites.split(",") );
        }
View Full Code Here

Examples of java.net.ServerSocket

    public String getName() {
        return endpointName;
    }

    protected ServerSocket createSocket( int port ) throws IOException {
        ServerSocket socket = factory.createServerSocket( port );
        return socket;
    }
View Full Code Here

Examples of java.net.ServerSocket

 
    throws IOException
  {
    error_listener  = _error_listener;
   
    server_socket = new ServerSocket( 0, 50, InetAddress.getByName( "127.0.0.1" ));
   
    new AEThread2( "TranscodePipe", true )
    {
      public void
      run()
View Full Code Here

Examples of java.net.ServerSocket

   * @param forceRemoteIndex force the thread to use a {@link RemoteIndex} instead
   * of a {@link RemoteBitStreamIndex}, even if the latter would be usable.
   */

  public static void start( final Index index, final InetAddress address, final int port, boolean forceRemoteIndex ) throws IOException {
    start( index, new ServerSocket( port, 0, address ), forceRemoteIndex );
  }
View Full Code Here

Examples of java.net.ServerSocket

        this.key = key;
        this.servers = servers;
        this.kill = kill;
        setDaemon(true);
        setName("StopJettyPluginMonitor");
        serverSocket = new ServerSocket(port, 1, InetAddress.getByName("127.0.0.1"));
        serverSocket.setReuseAddress(true);
    }
View Full Code Here

Examples of java.net.ServerSocket

     *
     * @throws IOException
     */
    public static int findFreePort(int initPort) throws IOException {
        int port = -1;
        ServerSocket tmpSocket = null;
        // first try the default port
        try {
            tmpSocket = new ServerSocket(initPort);

            port = initPort;
           
            System.out.println("Using default port: " + port);
        } catch (IOException e) {
            System.out.println("Failed to use specified port");
            // didn't work, try to find one dynamically
            try {
                int attempts = 0;

                while (port < 1024 && attempts < 2000) {
                    attempts++;

                    tmpSocket = new ServerSocket(0);

                    port = tmpSocket.getLocalPort();
                }

            } catch (IOException e1) {
                throw new IOException(
                        "Failed to find a port to use for testing: "
                                + e1.getMessage());
            }
        } finally {
            if (tmpSocket != null) {
                try {
                    tmpSocket.close();
                } catch (IOException e) {
                    // ignore
                }
                tmpSocket = null;
            }
View Full Code Here

Examples of java.net.ServerSocket

            InetAddress bindAddress = getBindAddress();
            if (ssl) {
                return CipherFactory.createServerSocket(port, bindAddress);
            }
            if (bindAddress == null) {
                return new ServerSocket(port);
            }
            return new ServerSocket(port, 0, bindAddress);
        } catch (BindException be) {
            throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2,
                    be, "" + port, be.toString());
        } catch (IOException e) {
            throw DbException.convertIOException(e, "port: " + port + " ssl: " + ssl);
View Full Code Here

Examples of java.net.ServerSocket

    /**
     * @return binded sock address
     */
    public InetSocketAddress setup() throws IOException {
        ServerSocket servSocket = serverChannel.socket();
        servSocket.setReuseAddress(true);
        InetSocketAddress sockaddr = NetUtils.getAnyLocalInetSocketAddress();
        servSocket.bind(sockaddr);
        return sockaddr;
    }
View Full Code Here

Examples of java.net.ServerSocket

        servSocket.bind(sockaddr);
        return sockaddr;
    }

    public void setup(int port) throws IOException {
        ServerSocket servSocket = serverChannel.socket();
        servSocket.setReuseAddress(true);
        InetAddress addr = NetUtils.getLocalHost(false);
        InetSocketAddress sockaddr = new InetSocketAddress(addr, port);
        servSocket.bind(sockaddr);
    }
View Full Code Here

Examples of java.net.ServerSocket

     * @return the port we opened or -1 if we couldn't open one.
   */
   private int connect()
   {
       try {
           serverSocket = new ServerSocket(0);
           return serverSocket.getLocalPort();
       } catch (IOException e) {
           logger.error( "Could not listen on port: " + port, e );
           return -1;
       }
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.