Package org.simpleframework.transport.connect

Examples of org.simpleframework.transport.connect.SocketConnection


               }
            }
         }
      };
      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


    private String responseText = "";
    private int code = 200;

    public DummyServer() {
        try {
            connection = new SocketConnection(new Container(){
                @Override public void handle(Request request, Response response) {
                    try {
                        handleSafely(response);
                    } catch (IOException e) {
                        throw new IllegalStateException(e);
View Full Code Here

    this.port = port;
  }

  public void start() throws Exception {
    handler = new ExpectationHandler();
    connection = new SocketConnection(handler);
    SocketAddress address = new InetSocketAddress(port);
    connection.connect(address);
  }
View Full Code Here

    public HttpFileServer start(File contentRoot, int port) {
        Container container = new SimpleFileServerContainer(new FileContext(contentRoot));

        try {
            final Server server = new ContainerServer(container);
            Connection connection = new SocketConnection(server);
            InetSocketAddress address = new InetSocketAddress(port);
            InetSocketAddress usedAddress = (InetSocketAddress)connection.connect(address);

            return new SimpleHttpFileServer(contentRoot, usedAddress.getPort(), new Stoppable() {
                public void stop() {
                    try {
                        server.stop();
View Full Code Here

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

        connection.connect(listen, context);

        return connection;
    }
View Full Code Here

       
        if(port == -1) {
           port = defaultPort;
        }        
        SocketAddress listen = new InetSocketAddress(port);
        Connection connection = new SocketConnection(container);
       
        connection.connect(listen, context);
       
        return connection;
   
View Full Code Here

        if (connection != null) {
            connection.close();
        }

        proxy = new ProxyImplementation();
        connection = new SocketConnection(proxy);
        final SocketAddress address = new InetSocketAddress(port);
        connection.connect(address);
        LOGGER.debug("Started on port: " + port);
    }
View Full Code Here

     *
     * @throws IOException In case starting fails.
     */
    public void start() throws IOException {
        handler = new ExpectationHandler();
        connection = new SocketConnection(handler);
        final SocketAddress address = new InetSocketAddress(port);
        connection.connect(address);
    }
View Full Code Here

                    throw new RuntimeException(e);
                }
            }
        };
        Server server = new ContainerServer(container);
        connection = new SocketConnection(server);
        SocketAddress address = new InetSocketAddress(port);

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

TOP

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

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.