Package org.xsocket.connection

Examples of org.xsocket.connection.Server


            public boolean onData(INonBlockingConnection connection) throws IOException, BufferUnderflowException, ClosedChannelException, MaxReadSizeExceededException {
                // do nothing
                return false;
            }
        };
        IServer server = new Server(dh);
        server.start();
       
       
        HttpClient httpClient = new HttpClient();
        httpClient.setResponseTimeoutMillis(500);
       
        ResponseHandler rh = new ResponseHandler();
        httpClient.send(new GetRequest("http://localhost:" + server.getLocalPort() + "/"), rh);
       
        QAUtil.sleep(1500);
       
        Assert.assertTrue(rh.threadnameRef.get().indexOf("ool-") != -1);
        Assert.assertNull(rh.responseRef.get());
View Full Code Here


                                 "\r\n" +
                                 "12345");
                return false;
            }
        };
        IServer server = new Server(dh);
        server.start();
       
       
        HttpClient httpClient = new HttpClient();
       
        NonThreadedResponseHandler rh = new NonThreadedResponseHandler();
        httpClient.send(new GetRequest("http://localhost:" + server.getLocalPort() + "/"), rh);
       
        QAUtil.sleep(1000);
       
        Assert.assertTrue(rh.threadnameRef.get().startsWith("xDispatcher"));
        Assert.assertNotNull(rh.responseRef.get());
View Full Code Here

                                 "Conte");
                connection.close();
                return false;
            }
        };
        IServer server = new Server(dh);
        server.start();
       
       
        HttpClient httpClient = new HttpClient();
       
        NonThreadedResponseHandler rh = new NonThreadedResponseHandler();
        httpClient.send(new GetRequest("http://localhost:" + server.getLocalPort() + "/"), rh);
       
        QAUtil.sleep(1000);
       
        Assert.assertTrue(rh.threadnameRef.get().startsWith("xDispatcher"));
        Assert.assertNull(rh.responseRef.get());
View Full Code Here

            public boolean onData(INonBlockingConnection connection) throws IOException, BufferUnderflowException, ClosedChannelException, MaxReadSizeExceededException {
                // do nothing
                return false;
            }
        };
        IServer server = new Server(dh);
        server.start();
       
       
        HttpClient httpClient = new HttpClient();
        httpClient.setResponseTimeoutMillis(500);
       
        NonThreadedResponseHandler rh = new NonThreadedResponseHandler();
        httpClient.send(new GetRequest("http://localhost:" + server.getLocalPort() + "/"), rh);
       
        QAUtil.sleep(1500);
       
        Assert.assertTrue(rh.threadnameRef.get().startsWith("xHttpTimer"));
        Assert.assertNull(rh.responseRef.get());
View Full Code Here

                return true;
            }
        };
       
       
        Server server = new Server(dh);
        server.start();
       
       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        try {
            con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        } catch (IOException expected) { }
       
        server.close();
    }
View Full Code Here

                return true;
            }
        };
       
       
        Server server = new Server(dh);
        server.start();
       
       
        HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
       
        IHttpResponse response = con.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("<ht", response.getBody().readString());
       
        server.close();
    }
View Full Code Here

              connection.close();
              return true;
          }
      };
     
        Server server = new Server(dh);
        server.start();
       
        HttpClient httpClient = new HttpClient();
       
       
        IHttpRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test/12345");
        IHttpResponse resp = httpClient.call(request);
        Assert.assertEquals(302, resp.getStatus());
        Assert.assertEquals("123456", resp.getBody().readString());
       
       
        httpClient.close();
        server.close();     
    }
View Full Code Here

                connection.close();
                return true;
            }
        };
       
        Server server = new Server(dh);
        server.start();
       
        HttpClient httpClient = new HttpClient();
        httpClient.setCacheMaxSizeKB(100);
       
       
        IHttpRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test/12345");
        IHttpResponse resp = httpClient.call(request);
        Assert.assertEquals(302, resp.getStatus());
        Assert.assertEquals("123456", resp.getBody().readString());
       
       
        httpClient.close();
        server.close();    
    }      
View Full Code Here

   
    public SimpleDualPortServer(int httpListenport, int tcpListenport) throws IOException {
        Registry registry = new Registry();
       
        httpServer = new HttpServer(httpListenport, new HttpRequestHandler(registry));
        tcpServer = new Server(tcpListenport, new TcpConnectHandler(registry));
    }
View Full Code Here

              connection.close();
              return true;
          }
      };
     
        Server server = new Server(dh);
        server.start();
       
        HttpClient httpClient = new HttpClient();
       
       
        IHttpRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test/12345");
        IHttpResponse resp = httpClient.call(request);
        Assert.assertEquals(302, resp.getStatus());
        Assert.assertEquals("123456", resp.getBlockingBody().readString());
       
       
        httpClient.close();
        server.close();     
    }
View Full Code Here

TOP

Related Classes of org.xsocket.connection.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.