Package org.littleshoot.proxy

Examples of org.littleshoot.proxy.DefaultHttpProxyServer


        responseDeenrichmentFilter.initialize(serviceLoader().onlyOne(HttpResponseDeenrichmentService.class));

        String hostPort = realUrl.getHost() + ":" + realUrl.getPort();
        ResponseFilterMap responseFilterMap = new ResponseFilterMap(hostPort, responseDeenrichmentFilter);

        HttpProxyServer server = new DefaultHttpProxyServer(proxyUrl.getPort(), responseFilterMap, hostPort, null,
                requestFilter);

        server.start();

        return server;
    }
View Full Code Here


    public void destroyServer() {
        server.stop();
    }

    public HttpProxyServer initProxy() {
        HttpProxyServer proxyServer = new DefaultHttpProxyServer(PROXY_PORT);
        proxyServer.start(true, true);
        return proxyServer;
    }
View Full Code Here

        }
    }

    public HttpProxyServer getProxy() {
        Map<String, HttpFilter> filters = new HashMap<String, HttpFilter>();
        HttpProxyServer proxyServer = new DefaultHttpProxyServer(PROXY_PORT, filters, null, null, null);
        return proxyServer;
    }
View Full Code Here

    public void destroyServer() {
        server.stop();
    }

    public HttpProxyServer initProxy() {
        HttpProxyServer proxyServer = new DefaultHttpProxyServer(PROXY_PORT);
        proxyServer.start(true, true);
        return proxyServer;
    }
View Full Code Here

    public void destroyServer() {
        server.stop();
    }

    public HttpProxyServer initProxy() {
        HttpProxyServer proxyServer = new DefaultHttpProxyServer(PROXY_PORT);
        proxyServer.start(true, true);
        return proxyServer;
    }
View Full Code Here

        if (!canTest()) {
            return;
        }

        // start http proxy
        HttpProxyServer proxyServer = new DefaultHttpProxyServer(proxyPort);
        proxyServer.addProxyAuthenticationHandler(new ProxyAuthorizationHandler() {
            @Override
            public boolean authenticate(String userName, String password) {
                return "user".equals(userName) && "password".equals(password);
            }
        });
        proxyServer.start();

        template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin&proxy=#proxy", "Hello World", Exchange.FILE_NAME, "hello.txt");

        File file = new File(FTP_ROOT_DIR + "/hello.txt");
        assertTrue("File should exist: " + file, file.exists());
        assertEquals("Hello World", context.getTypeConverter().convertTo(String.class, file));
       
        proxyServer.stop();
    }
View Full Code Here

        if (!canTest()) {
            return;
        }

        // start http proxy
        HttpProxyServer proxyServer = new DefaultHttpProxyServer(proxyPort);
        proxyServer.addProxyAuthenticationHandler(new ProxyAuthorizationHandler() {
            @Override
            public boolean authenticate(String userName, String password) {
                return "user".equals(userName) && "password".equals(password);
            }
        });
        proxyServer.start();

        template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "/mysub?username=admin&password=admin&proxy=#proxy", "Bye World", Exchange.FILE_NAME, "bye.txt");

        File file = new File(FTP_ROOT_DIR + "/mysub/bye.txt");
        assertTrue("File should exist: " + file, file.exists());
        assertEquals("Bye World", context.getTypeConverter().convertTo(String.class, file));

        proxyServer.stop();
    }
View Full Code Here

        if (!canTest()) {
            return;
        }

        // start http proxy
        HttpProxyServer proxyServer = new DefaultHttpProxyServer(proxyPort);
        proxyServer.addProxyAuthenticationHandler(new ProxyAuthorizationHandler() {
            @Override
            public boolean authenticate(String userName, String password) {
                return "user".equals(userName) && "password".equals(password);
            }
        });
        proxyServer.start();

        template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "/mysub/myother?username=admin&password=admin&proxy=#proxy", "Farewell World", Exchange.FILE_NAME,
            "farewell.txt");

        File file = new File(FTP_ROOT_DIR + "/mysub/myother/farewell.txt");
        assertTrue("File should exist: " + file, file.exists());
        assertEquals("Farewell World", context.getTypeConverter().convertTo(String.class, file));

        proxyServer.stop();
    }
View Full Code Here

        if (!canTest()) {
            return;
        }

        // start http proxy
        HttpProxyServer proxyServer = new DefaultHttpProxyServer(proxyPort);
        proxyServer.addProxyAuthenticationHandler(new ProxyAuthorizationHandler() {
            @Override
            public boolean authenticate(String userName, String password) {
                return "user".equals(userName) && "password".equals(password);
            }
        });
        proxyServer.start();

        String expected = "Hello World";

        // create file using regular file
        template.sendBodyAndHeader("file://" + FTP_ROOT_DIR, expected, Exchange.FILE_NAME, "hello.txt");

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);
        mock.expectedHeaderReceived(Exchange.FILE_NAME, "hello.txt");
        mock.expectedBodiesReceived(expected);
       
        context.startRoute("foo");

        assertMockEndpointsSatisfied();
       
        proxyServer.stop();
    }
View Full Code Here

    @Before
    public void setUp() throws Exception {
        String host = System.getProperty("org.switchyard.test.http.host", "localhost");
        String port = System.getProperty("org.switchyard.test.http.port", "8080");
        _proxyServer = new DefaultHttpProxyServer(PROXYPORT);
        ProxyAuthorizationHandler authorizationHandler = new ProxyAuthorizationHandler() {
            @Override
            public boolean authenticate(String user, String pwd) {
                return (PROXY_USER.equals(user) && PROXY_PWD.equals(pwd));
            }
View Full Code Here

TOP

Related Classes of org.littleshoot.proxy.DefaultHttpProxyServer

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.