Package org.simpleframework.transport.connect

Examples of org.simpleframework.transport.connect.Connection


   * @return a closable that can be invoked in case the service is to be shut
   *         down
   */
  public Closeable initialize() {
    try {
      Connection connection = new SocketConnection(this);
      SocketAddress address = new InetSocketAddress(PORT_NUMBER);
      connection.connect(address);
      logger.info("HTTP service for ExtensionSwap installation running on port {}", PORT_NUMBER);
      return connection;
    } catch (IOException e) {
      logger.warn("Could not host HTTP service for ExtensionSwap installation on port " + PORT_NUMBER
          + ". Automatic installations of extensions will not be available.", e);
View Full Code Here


        // Complete initialization
        Container container = new SimpleContainer(this);
        ContainerServer server = new ContainerServer(container,
                getDefaultThreads());
        SimpleServer filter = new SimpleServer(server);
        Connection connection = new SocketConnection(filter);
        setConfidential(true);
        setContainerServer(server);
        setConnection(connection);

        // Effectively connect the server socket
View Full Code Here

        }
        final Container container = new SimpleContainer(this);
        final ContainerServer server = new ContainerServer(container,
                getDefaultThreads());
        final SimpleServer restletServer = new SimpleServer(server);
        final Connection connection = new SocketConnection(restletServer);

        setConfidential(false);
        setContainerServer(server);
        setConnection(connection);
View Full Code Here

import org.simpleframework.transport.trace.Trace;

public class RenegotiationExample {

   public static void main(String[] list) throws Exception {
      Connection serverCon = createServer(false, 443);     
      /*SSLSocket socketCon = createClient();
      OutputStream out = socketCon.getOutputStream();
     
      for(int i = 0; i < 1000; i++) {
         out.write("TEST".getBytes());  
         out.flush();
         Thread.sleep(5000);
      }*/
      Thread.sleep(1000000);
      serverCon.close();
   }
View Full Code Here

    }

    public static void main(String[] list) throws Exception {
        Container container = new HelloWorld();
        Server server = new ContainerServer(container);
        Connection connection = new SocketConnection(server);
        SocketAddress address = new InetSocketAddress(8080);

        connection.connect(address);
    }
View Full Code Here

     
      for(int i = 0; i < ITERATIONS; i++) {
         try {
            ServerCriteria criteria = createServer();
            InetSocketAddress address = criteria.getAddress();
            Connection connection = criteria.getConnection();
            Client client = createClient(address, String.format("[%s of %s]", i, ITERATIONS));
           
            Thread.sleep(2000); // allow some requests to execute
            connection.close();
            Thread.sleep(100); // ensure client keeps executing
            client.close();
            Thread.sleep(1000); // wait for threads to terminate
         }catch(Exception e) {
            e.printStackTrace();
View Full Code Here

               }
            }
         }
      };
      ContainerServer server = new ContainerServer(container);
      Connection connection = new SocketConnection(server);
      InetSocketAddress address = (InetSocketAddress)connection.connect(null); // ephemeral port
     
      return new ServerCriteria(connection, address);
   }
View Full Code Here

        if (port == -1) {
            port = defaultPort;
        }
        SocketAddress listen = new InetSocketAddress(port);
        Connection connection;
        try {
            Server server = new ContainerServer(container);
            connection = new SocketConnection(server);

            connection.connect(listen, context);
            container.onServerStart();
        } catch (IOException ex) {
            throw new ProcessingException("IOException thrown when trying to create simple server", ex);
        }
        return connection;
View Full Code Here

        if (port == -1) {
            port = defaultPort;
        }
        final InetSocketAddress listen = new InetSocketAddress(port);
        final Connection connection;
        try {
            final Server server = serverProvider.get();
            connection = new SocketConnection(server);

            final SocketAddress socketAddr = connection.connect(listen, context);
            container.onServerStart();

            return new SimpleServer() {

                @Override
                public void close() throws IOException {
                    container.onServerStop();
                    connection.close();
                }

                @Override
                public int getPort() {
                    return ((InetSocketAddress) socketAddr).getPort();
View Full Code Here

     
      for(int i = 0; i < ITERATIONS; i++) {
         try {
            ServerCriteria criteria = createServer();
            InetSocketAddress address = criteria.getAddress();
            Connection connection = criteria.getConnection();
            Client client = createClient(address, String.format("[%s of %s]", i, ITERATIONS));
           
            Thread.sleep(2000); // allow some requests to execute
            connection.close();
            Thread.sleep(100); // ensure client keeps executing
            client.close();
            Thread.sleep(1000); // wait for threads to terminate
         }catch(Exception e) {
            e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.simpleframework.transport.connect.Connection

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.