Package org.xsocket.connection

Examples of org.xsocket.connection.IServer


                return true;
            }
        };
       
        IServer server = new Server(dh);
        server.start();


        HttpClient httpClient = new HttpClient();
        httpClient.setCallReturnOnMessage(true);
       
        IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test"));
       
        Assert.assertEquals(200, response.getStatus());
        Assert.assertTrue(response.getNonBlockingBody().isCompleteReceived());
       
        httpClient.close();
        server.close();
    }
View Full Code Here


                return true;
            }
        };
       
        IServer server = new Server(dh);
        server.start();


        HttpClient httpClient = new HttpClient();
        httpClient.setCallReturnOnMessage(true);
       
        IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test"));
       
        Assert.assertEquals(200, response.getStatus());
        Assert.assertTrue(response.getNonBlockingBody().isCompleteReceived());
       
        httpClient.close();
        server.close();
    }   
View Full Code Here

                return true;
            }
        };
       
        IServer server = new Server(dh);
        server.start();


        HttpClient httpClient = new HttpClient();
        httpClient.setMaxRetries(4);
        httpClient.setCallReturnOnMessage(true);
       
        try {
            httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/test"));
            Assert.fail("IOException expected");
        } catch (IOException expected) { }
       
       
        httpClient.close();
        server.close();
    }
View Full Code Here

                return true;
            }
        };
       
        IServer server = new Server(dh);
        server.start();

       
        HttpClient httpClient = new HttpClient();
       
        GetRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
        IHttpResponse response = httpClient.call(request);
       
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("12345", response.getBlockingBody().readString());
       
        httpClient.close();
        server.close();
    }
View Full Code Here

                return true;
            }
        };
       
        IServer server = new Server(dh);
        server.start();

       
        HttpClient httpClient = new HttpClient();
       
        GetRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
        IHttpResponse response = httpClient.call(request);
       
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("12345", response.getBlockingBody().readString());
       
        httpClient.close();
        server.close();
    }
View Full Code Here

                return true;
            }
        };
       
        IServer server = new Server(dh);
        server.start();

       
        HttpClient httpClient = new HttpClient();
       
        GetRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
        IHttpResponse response = httpClient.call(request);
       
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("12345", response.getBlockingBody().readString());
       
        httpClient.close();
        server.close();
    }
View Full Code Here

                return true;
            }
        };
       
        IServer server = new Server(dh);
        server.start();

       
        HttpClient httpClient = new HttpClient();
       
        GetRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
        ResponseHandler respHdl = new ResponseHandler();
        httpClient.send(request, respHdl);
       
       
        while (respHdl.getResponse() == null) {
            QAUtil.sleep(100);
        }
       
        IHttpResponse response = respHdl.getResponse();
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("12345", response.getBlockingBody().readString());
       
        httpClient.close();
        server.close();
    }
View Full Code Here

                return true;
            }
        };
       
        IServer server = new Server(dh);
        server.start();

       
        HttpClient httpClient = new HttpClient();
        httpClient.setMaxRetries(6);
       
        GetRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
       
        try {
            IHttpResponse response = httpClient.call(request);
            Assert.fail("IOException expected");
        } catch (IOException expected) {  }
       
        httpClient.close();
        server.close();
    }
View Full Code Here

                return true;
            }
        };
       
        IServer server = new Server(dh);
        server.start();

       
        HttpClient httpClient = new HttpClient();
        httpClient.setMaxRetries(0);
       
        GetRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/test");
       
        try {
            IHttpResponse response = httpClient.call(request);
            Assert.fail("IOException expected");
        } catch (IOException expected) {  }
       
        httpClient.close();
        server.close();
    }
View Full Code Here

                return true;
            }
        };
       
        IServer server = new Server(dh);
        server.start();

       
        HttpClient httpClient = new HttpClient();
       
        DeleteRequest request = new DeleteRequest("http://localhost:" + server.getLocalPort() + "/test");
        IHttpResponse response = httpClient.call(request);
       
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("12345", response.getBlockingBody().readString());
       
        httpClient.close();
        server.close();
    }
View Full Code Here

TOP

Related Classes of org.xsocket.connection.IServer

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.