Package java.net

Examples of java.net.ServerSocket


         * next free port. We then need to store the port actually used
         * back into the configuration so application launching can
         * work.
         */
        boolean resetPort = listeningSocketConfiguration.getSourcePort() == 0;
            server = new ServerSocket(listeningSocketConfiguration.getSourcePort(), 50, InetAddress.getByName(getAddressToBind()));
            if(resetPort) {
                // #ifdef DEBUG
            log.info("Chosen port " + server.getLocalPort()) ; //$NON-NLS-1$
                // #endif
              listeningSocketConfiguration.setSourcePort(server.getLocalPort());
View Full Code Here


    super();
    this.eagleDNS = eagleDNS;
    this.addr = addr;
    this.port = port;

    serverSocket = new ServerSocket(port, 128, addr);

    this.setDaemon(true);
    this.start();
  }
View Full Code Here

            PropertyClass propertyClass = definition.getPropertyClass();
            AbstractPropertyKey propertyKey = new AbstractPropertyKey(definition.getName(), propertyClass.getName());
            int oldValue = propertyClass.retrievePropertyInt(propertyKey);
            if (oldValue != portInt) {
                try {
                    ServerSocket socket = new ServerSocket(portInt);
                    socket.close();
                } catch (Exception e) {
                    log.error("Failed to open server socket.", e);
                    throw new CoreException(ErrorConstants.ERR_INTERNAL_ERROR, ErrorConstants.CATEGORY_NAME,
                                    ErrorConstants.BUNDLE_NAME, e, value);
                }
View Full Code Here

    @Test(expected = CoreException.class)
    public void validPortSocketInUse() throws CodedException, IOException, JDOMException {
        PropertyDefinition definition = getWebServerPortDefinition();
        assertPortNotInUse(69);

        ServerSocket socket = new ServerSocket(69);
        try {
            PortValidator validator = new PortValidator();
            validator.validate(definition, "69", null);
        } finally {
            socket.close();
        }
    }
View Full Code Here

        ContextConfig config = new ContextConfig(getClass().getClassLoader());
        return config.getDefinition("webServer.port");
    }

    private void assertPortNotInUse(int port) throws IOException {
        ServerSocket socket = null;
        try {
            socket = new ServerSocket(port);
        } finally {
            if (socket != null) {
                socket.close();
            }
        }
    }
View Full Code Here

        return new ServerSocket(port);
    }

    @Override
    public ServerSocket createServerSocket(int port, int backlog) throws IOException {
        return new ServerSocket(port, backlog);
    }
View Full Code Here

        return new ServerSocket(port, backlog);
    }

    @Override
    public ServerSocket createServerSocket(int port, int backlog, InetAddress address) throws IOException {
        return new ServerSocket(port, backlog, address);
    }
View Full Code Here

     * @throws IOException if unable to create socket
     */
    public ServerSocket createServerSocket( final int port )
        throws IOException
    {
        return new ServerSocket( port );
    }
View Full Code Here

     * @throws IOException if unable to create socket
     */
    public ServerSocket createServerSocket( int port, int backlog )
        throws IOException
    {
        return new ServerSocket( port, backlog );
    }
View Full Code Here

        }
        catch( IOException e )
        {
        }

        final ServerSocket ss1 = ssf.createServerSocket( PORT );
        readWriteTestsOnSingleSocket( ss1, csf );

        final ServerSocket ss2 = ssf.createServerSocket( PORT, 1 );
        readWriteTestsOnSingleSocket( ss2, csf );

        final ServerSocket ss3 = ssf.createServerSocket( PORT, 1, HOST );
        readWriteTestsOnSingleSocket( ss3, csf );
    }
View Full Code Here

TOP

Related Classes of java.net.ServerSocket

Copyright © 2018 www.massapicom. 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.