Package org.simpleframework.transport

Examples of org.simpleframework.transport.Server


        }
    }

    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


      private final String message;
     
      public PingServer(int port, String message) throws Exception {
         Allocator allocator = new FileAllocator();
         Processor processor  = new ContainerProcessor(this, allocator, 5);
         Server server = new ProcessorServer(processor);
         DebugServer debug = new DebugServer(server);
        
         this.connection = new SocketConnection(debug);
         this.address = new InetSocketAddress(port);
         this.message = message;
View Full Code Here

            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) {
View Full Code Here

     * @throws Exception
     */
   public void start(int port) throws Exception {
      ServerLyzer.port = port;
      Container container = new ServerLyzer(config);
      Server server = new ContainerServer(container);
      this.connection = new SocketConnection(server);
      SocketAddress address = new InetSocketAddress(port);
      System.out.println("Starting server on port "+port);
      this.connection.connect(address);
   }
View Full Code Here

            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();
View Full Code Here

  public static Connection connection;
  public PrintStream stdOut = System.out;

  public static void start() throws Exception {
    Container container = new HttpServer();
    Server server = new ContainerServer(container);
    connection = new SocketConnection(server);
    SocketAddress address = new InetSocketAddress(Integer.valueOf(StartMain.args[0]));
   
    connection.connect(address);
   
View Full Code Here

    public HttpMockServer(@Nonnull JSONObject jsonObject, @Nonnull ConfigReader configReader, @Nonnull NetworkType simulatedNetworkType)
            throws IOException, JSONException {
        ConfigResult config = new ConfigParser(configReader).parseConfig(jsonObject);
        this.responseHandler = new ResponseHandler(config.responses, simulatedNetworkType, configReader);
        Server server = new ContainerServer(this);
        conn = new SocketConnection(server);
        final SocketAddress sa = new InetSocketAddress(config.port);
        conn.connect(sa);
    }
View Full Code Here

      private final String message;
     
      public PingServer(int port, String message) throws Exception {
         Allocator allocator = new FileAllocator();
         Processor processor  = new ContainerProcessor(this, allocator, 5);
         Server server = new ProcessorServer(processor);
         DebugServer debug = new DebugServer(server);
        
         this.connection = new SocketConnection(debug);
         this.address = new InetSocketAddress(port);
         this.message = message;
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();
                    } catch (IOException e) {
                        throw new UncheckedIOException(e);
                    }
                }
            });
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

TOP

Related Classes of org.simpleframework.transport.Server

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.