Package org.reficio.ws.it.util

Examples of org.reficio.ws.it.util.SslTunnel$PipeThread


        return securityContext;
    }

    private SslTunnel getProxyTunnel() {
        KeyStore ks = readKeyStore(getKeyStoreUrlTwo(), getKeyStorePassword(), "JKS");
        SslTunnel tunnel = new SslTunnel(ks, getKeyStorePassword(), PROXY_SSL_PORT, "localhost", PROXY_PORT);
        return tunnel;
    }
View Full Code Here


    @Test
    public void testService1_httpsProxy_noAuthentication() throws Exception {

        KeyStore ks = readKeyStore(getKeyStoreUrlOne(), getKeyStorePassword(), "JKS");
        SslTunnel tunnel = new SslTunnel(ks, getKeyStorePassword(), 9898, "localhost", 9797);
        tunnel.start();

        HttpProxyServer proxyServer = initProxy();
        try {

            final Security securityContext = Security.builder()
                    .trustStoreUrl(getKeyStoreUrlOne())
                    .trustStorePassword(getKeyStorePassword())
                    .build();

            verifyServiceBehavior(1, new ClientBuilder() {
                @Override
                public SoapClient buildClient(String endpointUrl) {
                    return SoapClient.builder().endpointUri("http://" + endpointUrl)
                            .proxyUri("https://127.0.0.1:" + 9898)
                            .proxySecurity(securityContext)
                            .build();
                }
            });
        } finally {
            tunnel.stop();
            proxyServer.stop();
        }
    }
View Full Code Here

    @Test
    public void testService1_httpProxy_basicAuthentication_success() throws Exception {

        KeyStore ks = readKeyStore(getKeyStoreUrlOne(), getKeyStorePassword(), "JKS");
        SslTunnel tunnel = new SslTunnel(ks, getKeyStorePassword(), 9898, "localhost", 9797);
        tunnel.start();

        HttpProxyServer proxyServer = initProxy();
        proxyServer.addProxyAuthenticationHandler(new ProxyAuthorizationHandler() {
            @Override
            public boolean authenticate(String user, String pass) {
                return user.equals("tom") && pass.equals("007");
            }
        });
        try {

            final Security security = Security.builder()
                    .authBasic("tom", "007")
                    .trustStoreUrl(getKeyStoreUrlOne())
                    .trustStorePassword(getKeyStorePassword())
                    .build();

            verifyServiceBehavior(1, new ClientBuilder() {
                @Override
                public SoapClient buildClient(String endpointUrl) {
                    return SoapClient.builder()
                            .endpointUri("http://" + endpointUrl)
                            .proxyUri("https://127.0.0.1:" + 9898)
                            .proxySecurity(security)
                            .build();
                }
            });
        } finally {
            tunnel.stop();
            proxyServer.stop();
        }
    }
View Full Code Here

        exception.expect(TransmissionException.class);
        exception.expectMessage("[407]");

        KeyStore ks = readKeyStore(getKeyStoreUrlOne(), getKeyStorePassword(), "JKS");
        SslTunnel tunnel = new SslTunnel(ks, getKeyStorePassword(), 9898, "localhost", 9797);
        tunnel.start();

        HttpProxyServer proxyServer = initProxy();

        proxyServer.addProxyAuthenticationHandler(new ProxyAuthorizationHandler() {
            @Override
            public boolean authenticate(String user, String pass) {
                return user.equals("tom") && pass.equals("007");
            }
        });

        final Security props = Security.builder()
                .authBasic("james", "003")
                .trustStoreUrl(getKeyStoreUrlOne())
                .trustStorePassword(getKeyStorePassword())
                .build();

        try {
            verifyServiceBehavior(1, new ClientBuilder() {
                @Override
                public SoapClient buildClient(String endpointUrl) {
                    return SoapClient.builder().endpointUri("http://" + endpointUrl)
                            .proxyUri("https://127.0.0.1:" + 9898)
                            .proxySecurity(props)
                            .build();
                }
            });
        } finally {
            tunnel.stop();
            proxyServer.stop();
        }
    }
View Full Code Here

        exception.expect(SoapClientException.class);
        exception.expectMessage("peer not authenticated");

        KeyStore ks = readKeyStore(getKeyStoreUrlTwo(), getKeyStorePassword(), "JKS");
        SslTunnel tunnel = new SslTunnel(ks, getKeyStorePassword(), 9898, "localhost", 9797);
        tunnel.start();

        HttpProxyServer proxyServer = initProxy();

        proxyServer.addProxyAuthenticationHandler(new ProxyAuthorizationHandler() {
            @Override
            public boolean authenticate(String user, String pass) {
                return user.equals("tom") && pass.equals("007");
            }
        });

        final Security props = Security.builder()
                .authBasic("tom", "007")
                .trustStoreUrl(getKeyStoreUrlOne())
                .trustStorePassword(getKeyStorePassword())
                .build();

        try {
            verifyServiceBehavior(1, new ClientBuilder() {
                @Override
                public SoapClient buildClient(String endpointUrl) {
                    return SoapClient.builder().endpointUri("http://" + endpointUrl)
                            .proxyUri("https://127.0.0.1:" + 9898)
                            .proxySecurity(props)
                            .build();
                }
            });
        } finally {
            tunnel.stop();
            proxyServer.stop();
        }
    }
View Full Code Here

TOP

Related Classes of org.reficio.ws.it.util.SslTunnel$PipeThread

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.