Package com.jetdrone.vertx.yoke

Examples of com.jetdrone.vertx.yoke.Yoke.use()


public class VHost extends TestVerticle {

    @Test
    public void testLimit() {
        Yoke yoke = new Yoke(this);
        yoke.use(new Vhost("*.com", new Handler<HttpServerRequest>() {
            @Override
            public void handle(HttpServerRequest request) {
                request.response().end();
                testComplete();
            }
View Full Code Here


            public void handle(HttpServerRequest request) {
                request.response().end();
                testComplete();
            }
        }));
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                request.response().end();
                fail();
            }
View Full Code Here

    public void testJsonBodyParser() {

        final JsonObject json = new JsonObject().putString("key", "value");

        Yoke yoke = new Yoke(this);
        yoke.use(new com.jetdrone.vertx.yoke.middleware.BodyParser());
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                assertNotNull(request.body());
                assertEquals(((JsonObject) request.body()).encode(), json.encode());
View Full Code Here

        final JsonObject json = new JsonObject().putString("key", "value");

        Yoke yoke = new Yoke(this);
        yoke.use(new com.jetdrone.vertx.yoke.middleware.BodyParser());
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                assertNotNull(request.body());
                assertEquals(((JsonObject) request.body()).encode(), json.encode());
                request.response().end();
View Full Code Here

    @Test
    public void testIsTooBusy() throws Exception {

        final Yoke yoke = new Yoke(this);
        final TooBusy tooBusy = new TooBusy();
        yoke.use(tooBusy);
        yoke.use(new Middleware() {
            double cnt = 0;
            final SecureRandom rand = new SecureRandom();

            @Override
View Full Code Here

    public void testIsTooBusy() throws Exception {

        final Yoke yoke = new Yoke(this);
        final TooBusy tooBusy = new TooBusy();
        yoke.use(tooBusy);
        yoke.use(new Middleware() {
            double cnt = 0;
            final SecureRandom rand = new SecureRandom();

            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
View Full Code Here

    @Test
    public void testMapBodyParser() {

        Yoke yoke = new Yoke(this);
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                MultiMap body = request.formAttributes();
                assertEquals("value", body.get("param"));
                request.response().end();
View Full Code Here

    @Test
    public void testTextBodyParser() {

        Yoke yoke = new Yoke(this);
        yoke.use(new com.jetdrone.vertx.yoke.middleware.BodyParser());
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                Buffer body = request.body();
                assertEquals("hello-world", body.toString());
View Full Code Here

    @Test
    public void testTextBodyParser() {

        Yoke yoke = new Yoke(this);
        yoke.use(new com.jetdrone.vertx.yoke.middleware.BodyParser());
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                Buffer body = request.body();
                assertEquals("hello-world", body.toString());
                request.response().end();
View Full Code Here

    @Test
    public void testBodyParserWithEmptyBody() {

        Yoke yoke = new Yoke(this);
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                request.response().end();
            }
        });
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.