Examples of SocketConnection


Examples of org.simpleframework.transport.connect.SocketConnection

    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

Examples of org.simpleframework.transport.connect.SocketConnection

                                                      new GovernmentReport(new GovernmentWatchdog(network))));
    private final Connection connection;
    private final InetSocketAddress address;
   
    public CiEyeServer(int port) throws IOException {
        connection = new SocketConnection(container);
        address = new InetSocketAddress(port);
    }
View Full Code Here

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

Examples of org.simpleframework.transport.connect.SocketConnection

    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

Examples of org.simpleframework.transport.connect.SocketConnection

    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

Examples of org.simpleframework.transport.connect.SocketConnection

    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

Examples of org.simpleframework.transport.connect.SocketConnection

        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

Examples of org.simpleframework.transport.connect.SocketConnection

       
        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

Examples of org.simpleframework.transport.connect.SocketConnection

        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

Examples of org.simpleframework.transport.connect.SocketConnection

     *
     * @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
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.