Package org.jivesoftware.smackx.bytestreams.socks5

Examples of org.jivesoftware.smackx.bytestreams.socks5.Socks5Proxy.start()


        assertFalse(proxy.isRunning());

        ServerSocket serverSocket = new ServerSocket(0);
        SmackConfiguration.setLocalSocks5ProxyPort(-serverSocket.getLocalPort());

        proxy.start();

        assertTrue(proxy.isRunning());

        serverSocket.close();
View Full Code Here


    public void shouldOnlyStartOneServerThread() {
        int threadCount = Thread.activeCount();

        SmackConfiguration.setLocalSocks5ProxyPort(7890);
        Socks5Proxy proxy = Socks5Proxy.getSocks5Proxy();
        proxy.start();

        assertTrue(proxy.isRunning());
        assertEquals(threadCount + 1, Thread.activeCount());

        proxy.start();
View Full Code Here

        proxy.start();

        assertTrue(proxy.isRunning());
        assertEquals(threadCount + 1, Thread.activeCount());

        proxy.start();

        assertTrue(proxy.isRunning());
        assertEquals(threadCount + 1, Thread.activeCount());

        proxy.stop();
View Full Code Here

        proxy.stop();

        assertFalse(proxy.isRunning());
        assertEquals(threadCount, Thread.activeCount());

        proxy.start();

        assertTrue(proxy.isRunning());
        assertEquals(threadCount + 1, Thread.activeCount());

        proxy.stop();
View Full Code Here

     */
    @Test
    public void shouldCloseSocketIfNoSocks5Request() throws Exception {
        SmackConfiguration.setLocalSocks5ProxyPort(7890);
        Socks5Proxy proxy = Socks5Proxy.getSocks5Proxy();
        proxy.start();

        Socket socket = new Socket(proxy.getLocalAddresses().get(0), proxy.getPort());

        OutputStream out = socket.getOutputStream();
        out.write(new byte[] { 1, 2, 3 });
View Full Code Here

     */
    @Test
    public void shouldRespondWithErrorIfNoSupportedAuthenticationMethod() throws Exception {
        SmackConfiguration.setLocalSocks5ProxyPort(7890);
        Socks5Proxy proxy = Socks5Proxy.getSocks5Proxy();
        proxy.start();

        Socket socket = new Socket(proxy.getLocalAddresses().get(0), proxy.getPort());

        OutputStream out = socket.getOutputStream();

View Full Code Here

     */
    @Test
    public void shouldRespondWithErrorIfConnectionIsNotAllowed() throws Exception {
        SmackConfiguration.setLocalSocks5ProxyPort(7890);
        Socks5Proxy proxy = Socks5Proxy.getSocks5Proxy();
        proxy.start();

        Socket socket = new Socket(proxy.getLocalAddresses().get(0), proxy.getPort());

        OutputStream out = socket.getOutputStream();
        out.write(new byte[] { (byte) 0x05, (byte) 0x01, (byte) 0x00 });
View Full Code Here

     */
    @Test
    public void shouldSuccessfullyEstablishConnection() throws Exception {
        SmackConfiguration.setLocalSocks5ProxyPort(7890);
        Socks5Proxy proxy = Socks5Proxy.getSocks5Proxy();
        proxy.start();

        assertTrue(proxy.isRunning());

        String digest = new String(new byte[] { (byte) 0xAA });

View Full Code Here

            if (proxy.isRunning()) {
                proxy.stop();
                sb.append("Socks5Proxy stopped. ");
            }
            if (proxyEnabled) {
                proxy.start();
                sb.append("Socks5Proxy started on port " + proxy.getPort()
                    + "...");
            }
            log.debug(sb);
View Full Code Here

    public void shouldFailIfTargetIsNotConnectedToLocalSocks5Proxy() throws Exception {

        // start a local SOCKS5 proxy
        SmackConfiguration.setLocalSocks5ProxyPort(proxyPort);
        Socks5Proxy socks5Proxy = Socks5Proxy.getSocks5Proxy();
        socks5Proxy.start();

        // build stream host information for local SOCKS5 proxy
        StreamHost streamHost = new StreamHost(connection.getUser(),
                        socks5Proxy.getLocalAddresses().get(0));
        streamHost.setPort(socks5Proxy.getPort());
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.