Package net.sf.jproxyloader.config

Examples of net.sf.jproxyloader.config.ProxyConfig$Type


      System.out.println();

      ExprManager em = new ExprManager();
      SmtEngine smt = new SmtEngine(em);

      Type t = em.booleanType();
      Expr a = em.mkVar("a", em.booleanType());
      Expr b = em.mkVar("b", em.booleanType());
      Expr e = new Expr(em.mkExpr(Kind.AND, a, b, new Expr(a).notExpr()));
      System.out.println("==> " + e);
View Full Code Here


    // given
    CustomProxySelector customProxySelector = new CustomProxySelector(defaultProxySelectorMock, config);

    when(config.hasProxyConfigForHost("my.proxified.host.com")).thenReturn(true);
    when(config.getProxyConfigForHost("my.proxified.host.com")).thenReturn(
      new ProxyConfig("proxyhost", "1030", "http",
        new HashSet(asList("my.proxified.host.com"))));

    when(config.hasProxyConfigForHost("my.proxified.host2.com")).thenReturn(true);
    when(config.getProxyConfigForHost("my.proxified.host2.com")).thenReturn(
      new ProxyConfig("proxyhost2", "1040",
        "socks",
        new HashSet(asList("my.proxified.host2.com"))));

    // when
    List<Proxy> proxiesForProxifiedHost = customProxySelector.select(URI.create("some://my.proxified.host.com:5040"));
View Full Code Here

    }

  }

  private List<Proxy> getCustomProxyFor(URI uri) {
    ProxyConfig proxyConfig = config.getProxyConfigForHost(uri.getHost());
    return asList(proxyConfig.toJavaProxy());
  }
View Full Code Here

        String proxyHostname = trim(properties.getProperty(hostnameProperty));
        String proxyPort = trim(properties.getProperty(portProperty));
        String proxyType = trim(properties.getProperty(typeProperty));
        Set<String> proxyProxifiedHosts = parseProxifiedHosts(properties.getProperty(proxifiedHostsProperty));

        validProxies.add(new ProxyConfig(proxyHostname, proxyPort, proxyType, proxyProxifiedHosts));
      }
    }

    getLogger().debug(getClass().getSimpleName() + " - discovered following valid proxies: " + validProxies);
View Full Code Here

    List<ProxyConfig> customProxies = systemPropertiesConfig.getCustomProxies();

    // then
    assertThat(customProxies, notNullValue());
    assertThat(customProxies.size(), equalTo(2));
    assertThat(customProxies, hasItem(new ProxyConfig("www.myhost1.com", "8080", "http", EMPTY_SET)));
    assertThat(customProxies, hasItem(new ProxyConfig("192.168.1.200", "7070", "socks", EMPTY_SET)));

  }
View Full Code Here

    List<ProxyConfig> customProxies = systemPropertiesConfig.getCustomProxies();

    // then
    assertThat(customProxies, notNullValue());
    assertThat(customProxies.size(), equalTo(1));
    assertThat(customProxies, hasItem(new ProxyConfig("www.myhost1.com", "8080", "http", EMPTY_SET)));
    assertThat(logger.getLogBuffer(),
      containsString("Missing system property defining port for custom proxy: myProxy2"));

  }
View Full Code Here

    List<ProxyConfig> customProxies = systemPropertiesConfig.getCustomProxies();

    // then
    assertThat(customProxies, notNullValue());
    assertThat(customProxies.size(), equalTo(1));
    assertThat(customProxies, hasItem(new ProxyConfig("www.myhost1.com", "8080", "http", EMPTY_SET)));
    assertThat(logger.getLogBuffer(),
      containsString("Missing system property defining type for custom proxy: myProxy2"));

  }
View Full Code Here

    List<ProxyConfig> customProxies = systemPropertiesConfig.getCustomProxies();

    // then
    assertThat(customProxies, notNullValue());
    assertThat(customProxies.size(), equalTo(1));
    assertThat(customProxies, hasItem(new ProxyConfig("www.myhost1.com", "8080", "http", EMPTY_SET)));
    assertThat(logger.getLogBuffer(),
      containsString("Missing system property defining hostname for custom proxy: myProxy2"));

  }
View Full Code Here

            // now calculate the parameters
            int offset = 1;
            for (Class<?> aClass : delegatedMethod.getParameterTypes())
            {
                final Type type = Type.getType(aClass);
                mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), offset);
                offset += type.getSize();
            }

            // and finally invoke the target method on the provided Contextual Instance
            final Type declaringClass = Type.getType(delegatedMethod.getDeclaringClass());
            boolean interfaceMethod = Modifier.isInterface(delegatedMethod.getDeclaringClass().getModifiers());
            mv.visitMethodInsn(interfaceMethod ? Opcodes.INVOKEINTERFACE : Opcodes.INVOKEVIRTUAL,
                               declaringClass.getInternalName(), delegatedMethod.getName(), methodDescriptor);

            generateReturn(mv, delegatedMethod);

            mv.visitMaxs(-1, -1);
View Full Code Here

            mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_PROXIED_INSTANCE, Type.getDescriptor(classToProxy));

            int offset = 1;
            for (Class<?> aClass : delegatedMethod.getParameterTypes())
            {
                final Type type = Type.getType(aClass);
                mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), offset);
                offset += type.getSize();
            }

            final Type declaringClass = Type.getType(delegatedMethod.getDeclaringClass());
            mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, declaringClass.getInternalName(), delegatedMethod.getName(), methodDescriptor);

            generateReturn(mv, delegatedMethod);

            mv.visitMaxs(-1, -1);
View Full Code Here

TOP

Related Classes of net.sf.jproxyloader.config.ProxyConfig$Type

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.