Makes the proxy for ServerMonitorMXBean.
@return A ServerMonitorMXBean proxy object.
@throws IOException
558046
public ServerMonitorMXBean createServerMonitorProxy() throws IOException {
        String beanName = ServerMonitorMXBean.JMX_DOMAIN_NAME + ":type=" + ServerMonitorMXBean.JMX_TYPE_NAME;
        return createMXBeanProxy(beanName, ServerMonitorMXBean.class);
    }
1268695
private synchronized FileServiceMXBean getFileService() {
        if (fileService == null) {
            try {
                fileService = JMX.newMXBeanProxy(ManagementFactory.getPlatformMBeanServer(), new ObjectName(FileServiceMXBean.OBJECT_NAME), FileServiceMXBean.class);
            } catch (MalformedObjectNameException e) {
                throw ErrorHelper.createRESTHandlerJsonException(e, null, APIConstants.STATUS_INTERNAL_SERVER_ERROR);
            } catch (NullPointerException e) {
                throw ErrorHelper.createRESTHandlerJsonException(e, null, APIConstants.STATUS_INTERNAL_SERVER_ERROR);
            }
        }

        return fileService;
    }
1297359
private JMXConnector createConnector(JmxRequest pJmxReq) throws IOException {
        ProxyTargetConfig targetConfig = pJmxReq.getTargetConfig();
        if (targetConfig == null) {
            throw new IllegalArgumentException("No proxy configuration in request " + pJmxReq);
        }
        String urlS = targetConfig.getUrl();
        if (!acceptTargetUrl(urlS)) {
            throw new SecurityException(String.format("Target URL %s is not allowed by configuration", urlS));
        }

        JMXServiceURL url = new JMXServiceURL(urlS);

        Map<String,Object> env = prepareEnv(targetConfig.getEnv());
        return JMXConnectorFactory.newJMXConnector(url,env);
    }
1372236
@SuppressWarnings("unchecked")
    public static <T> T createProxyObject(Class<T> interfaceType, Object implementObject) {
        return (T) Proxy.newProxyInstance(
                implementObject.getClass().getClassLoader(),
                implementObject.getClass().getInterfaces(),
                new InvokeInterceptor(implementObject)
        );

    }
147426
public static <C> C getProxy(final Class<C> configInterface)
    {
        return getProxy(configInterface, Optional.empty());
    }
380610
def proxy_server(self):
        
        # TODO: Workaround for SMC 6.4.3 which only provides the inspected service
        # reference. We need to find the Proxy Server from this ref.
        if self._inspected_service_ref:
            for proxy in ProxyServer.objects.all():
                if self._inspected_service_ref.startswith(proxy.href):
                    return proxy
93260
private Proxy nextProxy() throws IOException {
    if (!hasNextProxy()) {
      throw new SocketException("No route to " + address.url().host()
          + "; exhausted proxy configurations: " + proxies);
    }
    Proxy result = proxies.get(nextProxyIndex++);
    resetNextInetSocketAddress(result);
    return result;
  }
296910
public ServerConfiguration copy() throws IOException {
        ReadableByteArrayOutputStream out = new ReadableByteArrayOutputStream();
        serialize(out);
        return new ServerConfigurationParser(out.toInputStream()).parse();
    }
402102
public ProxySelector proxySelector() {
        DefaultProxySelector dps = new DefaultProxySelector();

        for (Proxy proxy : settings.getProxies()) {
            dps.add(MavenConverter.asProxy(proxy), proxy.getNonProxyHosts());
        }

        return dps;
    }
96162
public Class getRealClass(Object objectOrProxy)
    {
        IndirectionHandler handler;

        if(isNormalOjbProxy(objectOrProxy))
        {
            String msg;

            try
            {
                handler = getIndirectionHandler(objectOrProxy);
                /*
                 arminw:
                 think we should return the real class
                 */
                // return handler.getIdentity().getObjectsTopLevelClass();
                return handler.getIdentity().getObjectsRealClass();
            }
            catch(ClassCastException e)
            {
                // shouldn't happen but still ...
                msg = "The InvocationHandler for the provided Proxy was not an instance of " + IndirectionHandler.class.getName();
                log.error(msg);
                throw new PersistenceBrokerException(msg, e);
            }
            catch(IllegalArgumentException e)
            {
                msg = "Could not retrieve real object for given Proxy: " + objectOrProxy;
                log.error(msg);
                throw new PersistenceBrokerException(msg, e);
            }
        }
        else if(isVirtualOjbProxy(objectOrProxy))
        {
            handler = VirtualProxy.getIndirectionHandler((VirtualProxy) objectOrProxy);
            /*
             arminw:
             think we should return the real class
             */
            // return handler.getIdentity().getObjectsTopLevelClass();
            return handler.getIdentity().getObjectsRealClass();
        }
        else
        {
            return objectOrProxy.getClass();
        }
    }
27047
@Benchmark
    public ExampleInterface benchmarkJdkProxy() throws Exception {
        return (ExampleInterface) Proxy.newProxyInstance(newClassLoader(),
                new Class<?>[]{baseClass},
                new InvocationHandler() {
                    public Object invoke(Object proxy, Method method, Object[] args) {
                        Class<?> returnType = method.getReturnType();
                        if (returnType.isPrimitive()) {
                            if (returnType == boolean.class) {
                                return defaultBooleanValue;
                            } else if (returnType == byte.class) {
                                return defaultByteValue;
                            } else if (returnType == short.class) {
                                return defaultShortValue;
                            } else if (returnType == char.class) {
                                return defaultCharValue;
                            } else if (returnType == int.class) {
                                return defaultIntValue;
                            } else if (returnType == long.class) {
                                return defaultLongValue;
                            } else if (returnType == float.class) {
                                return defaultFloatValue;
                            } else {
                                return defaultDoubleValue;
                            }
                        } else {
                            return defaultReferenceValue;
                        }
                    }
                }
        );
    }
581864
private TaskOperationProtocol getTaskManagerProxy() throws IOException {

		if (this.taskManager == null) {

			this.taskManager = RPC.getProxy(TaskOperationProtocol.class,
				new InetSocketAddress(getInstanceConnectionInfo().address(),
					getInstanceConnectionInfo().ipcPort()), NetUtils.getSocketFactory());
		}

		return this.taskManager;
	}
515860
protected Class<?> getProxyClass() throws ClassNotFoundException {
        ClassLoader classLoader = getProxyClassLoader();
        return Class.forName(proxyClassName, false, classLoader);
    }
393191
public final J4pClientBuilder useProxyFromEnvironment(){
        Map<String, String> env = System.getenv();
        for (String key : env.keySet()) {
            if (key.equalsIgnoreCase("http_proxy")){
                httpProxy = parseProxySettings(env.get(key));
                break;
            }
        }
        return this;
    }
1276138
private void createMonitor(LinkListener l) throws KNXException
	{
		final KNXMediumSettings medium = (KNXMediumSettings) options.get("medium");
		if (options.containsKey("serial")) {
			final String p = (String) options.get("serial");
			try {
				m = new KNXNetworkMonitorFT12(Integer.parseInt(p), medium);
			}
			catch (final NumberFormatException e) {
				m = new KNXNetworkMonitorFT12(p, medium);
			}
		}
		else {
			// create local and remote socket address for monitor link
			final InetSocketAddress local = createLocalSocket((InetAddress) options
				.get("localhost"), (Integer) options.get("localport"));
			final InetSocketAddress host = new InetSocketAddress((InetAddress) options
				.get("host"), ((Integer) options.get("port")).intValue());
			// create the monitor link, based on the KNXnet/IP protocol
			// specify whether network address translation shall be used,
			// and tell the physical medium of the KNX network
			m = new KNXNetworkMonitorIP(local, host, options.containsKey("nat"), medium);
		}
		// add the log writer for monitor log events
		LogManager.getManager().addWriter(m.getName(), w);
		// on console we want to have all possible information, so enable
		// decoding of a received raw frame by the monitor link
		m.setDecodeRawFrames(true);
		// listen to monitor link events
		m.addMonitorListener(l);
		// we always need a link closed notification (even with user supplied listener)
		m.addMonitorListener(new LinkListener() {
			public void indication(FrameEvent e)
			{}

			public void linkClosed(CloseEvent e)
			{
				System.out.println("network monitor exit, " + e.getReason());
				synchronized (NetworkMonitor.this) {
					NetworkMonitor.this.notify();
				}
			}
		});
	}
109338
<T> T createProxy(Class<T> interfaceClass, C adsServiceClient) {
    Set<Class<?>> interfaces = Sets.newHashSet(adsServiceClient.getClass().getInterfaces());
    interfaces.add(interfaceClass);
    Object proxy = Proxy.newProxyInstance(
        adsServiceClient.getSoapClient().getClass().getClassLoader(),
        interfaces.toArray(new Class[] {}), adsServiceClient);
    return interfaceClass.cast(proxy);
  }
682996
private XopBean createXopBean() throws Exception  {
        XopBean xop = new XopBean();
        xop.setName("xopName");
        
        InputStream is = getClass().getResourceAsStream("/java.jpg");
        byte[] data = IOUtils.readBytesFromStream(is);
        
        // Pass java.jpg as an array of bytes
        xop.setBytes(data);
        
        // Wrap java.jpg as a DataHandler
        xop.setDatahandler(new DataHandler(
                             new ByteArrayDataSource(data, "application/octet-stream")));
        
        if (Boolean.getBoolean("java.awt.headless")) {
            System.out.println("Running headless. Ignoring an Image property.");
        } else {
            xop.setImage(getImage("/java.jpg"));
        }
        
        return xop;
    }