当前位置: 首页>>代码示例>>Java>>正文


Java PyroProxy.close方法代码示例

本文整理汇总了Java中net.razorvine.pyro.PyroProxy.close方法的典型用法代码示例。如果您正苦于以下问题:Java PyroProxy.close方法的具体用法?Java PyroProxy.close怎么用?Java PyroProxy.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.razorvine.pyro.PyroProxy的用法示例。


在下文中一共展示了PyroProxy.close方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import net.razorvine.pyro.PyroProxy; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {

		setConfig();
		System.out.println("Testing Pyro handshake and custom annotations. Make sure the server from the pyro handshake example is running.");
		System.out.println("Pyrolite version: "+Config.PYROLITE_VERSION);
		System.out.println("serializer used: " + Config.SERIALIZER);

		Scanner scanner = new Scanner(System.in);
		System.out.println("\r\nEnter the server URI: ");
		String uri = scanner.next().trim();
		System.out.println("Enter the secret code as printed by the server: ");
		String secret = scanner.next().trim();
		scanner.close();
		
		PyroProxy p = new CustomAnnotationsProxy(new PyroURI(uri));
		p.pyroHandshake = secret;
		p.correlation_id = UUID.randomUUID();
		System.out.println("Correlation id set to: "+p.correlation_id);
		p.call("ping");
		System.out.println("Connection Ok!");
		
		// tidy up:
		p.close();
	}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:25,代码来源:HandshakeExample.java

示例2: main

import net.razorvine.pyro.PyroProxy; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {

		System.out.println("Testing Pyro autoproxy server (check the port number)...");
		System.out.println("Pyrolite version: "+Config.PYROLITE_VERSION);

		setConfig();
		
		PyroProxy p=new PyroProxy("localhost",51353,"example.autoproxy");	// change port number to whatever the server prints

		Object result=p.call("createSomething", 42);
		System.out.println("return value:");
		PrettyPrint.print(result);
		PyroProxy resultproxy=(PyroProxy)result;
		resultproxy.call("speak", "hello from java");
		
		p.close();
	}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:18,代码来源:AutoproxyExample.java

示例3: main

import net.razorvine.pyro.PyroProxy; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {

		System.out.println("Testing Pyro timezone example server (make sure it's running, with nameserver enabled, and pickle as serializer)...");
		System.out.println("Pyrolite version: "+Config.PYROLITE_VERSION);

		setConfig();

		NameServerProxy ns = NameServerProxy.locateNS(null);
		PyroProxy p = new PyroProxy(ns.lookup("example.timezones"));
		ns.close();

		
		Calendar cal;

		System.out.println("\nPYTZ...:");
		cal = (Calendar) p.call("pytz");
		System.out.println(cal);
		System.out.println("Timezone="+cal.getTimeZone());

		System.out.println("\nDATEUTIL...:");
		cal = (Calendar) p.call("dateutil");
		System.out.println(cal);
		System.out.println("Timezone="+cal.getTimeZone());

		System.out.println("\nECHO Timezone...:");
		cal = Calendar.getInstance();
		cal.set(Calendar.YEAR, 2015);
		cal.set(Calendar.MONTH, Calendar.MAY);
		cal.set(Calendar.DAY_OF_MONTH, 18);
		cal.set(Calendar.HOUR_OF_DAY, 23);
		cal.set(Calendar.MINUTE, 59);
		cal.set(Calendar.SECOND, 59);
		cal.set(Calendar.MILLISECOND, 998);
		cal.setTimeZone(TimeZone.getTimeZone("Europe/Amsterdam"));
		System.out.println("****" + javax.xml.bind.DatatypeConverter.printDateTime(cal));
		Calendar cal2 = (Calendar) p.call("echo", cal);
		System.out.println("****" + javax.xml.bind.DatatypeConverter.printDateTime(cal2));
		System.out.println(cal2);
		System.out.println("Timezone="+cal2.getTimeZone());
		if(!cal.equals(cal2))
			System.err.println("returned calendar is different!");
		
		// tidy up:
		p.close();
	}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:46,代码来源:TimezoneExample.java

示例4: main

import net.razorvine.pyro.PyroProxy; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {

		System.out.println("Testing Pyro echo server (make sure it's running, with nameserver enabled)...");
		System.out.println("Pyrolite version: "+Config.PYROLITE_VERSION);

		setConfig();

		NameServerProxy ns = NameServerProxy.locateNS(null, hmacKey);
		PyroProxy p = new PyroProxy(ns.lookup("test.echoserver"));
		p.pyroHmacKey = hmacKey;
		ns.close();
		
		// PyroProxy p=new PyroProxy("localhost",9999,"test.echoserver");

		Object x=42;
		System.out.println("echo param:");
		PrettyPrint.print(x);
		Object result=p.call("echo", x);
		System.out.println("return value:");
		PrettyPrint.print(result);
		
		String s="This string is way too long. This string is way too long. This string is way too long. This string is way too long. ";
		s=s+s+s+s+s;
		System.out.println("echo param:");
		PrettyPrint.print(s);
		result=p.call("echo", s);
		System.out.println("return value:");
		PrettyPrint.print(result);

		// echo a pyro proxy and validate that all relevant attributes are also present on the proxy we got back.
		System.out.println("proxy test.");
		result = p.call("echo", p);
		PyroProxy p2 = (PyroProxy) result;
		System.out.println("response proxy: " + p2);
		assert (p2.objectid=="test.echoserver");
		assert ((String)p2.pyroHandshake == "banana");
		assert (p2.pyroMethods.size() == 8);
		if(p2.pyroHmacKey!=null) {
			String hmac2 = new String(p2.pyroHmacKey);
			assert (hmac2==new String(hmacKey));
		}

		System.out.println("error test.");
		try {
			result=p.call("error");
		} catch (PyroException e) {
			System.out.println("Pyro Exception (expected)! "+e.getMessage());
			System.out.println("Pyro Exception cause: "+e.getCause());
			System.out.println("Pyro Exception remote traceback:\n>>>\n"+e._pyroTraceback+"<<<");
		}

		System.out.println("shutting down the test echo server.");
		p.call("shutdown");
		
		// tidy up:
		p.close();
	}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:58,代码来源:EchoExample.java

示例5: processHttpMessage

import net.razorvine.pyro.PyroProxy; //导入方法依赖的package包/类
@Override
public void processHttpMessage(int toolFlag, boolean messageIsRequest, IHttpRequestResponse messageInfo) {

	
	if(messageIsRequest) {
	
		byte[] request = messageInfo.getRequest();
		IRequestInfo analyzedRequest = helpers.analyzeRequest(request);
		List<String> headers = analyzedRequest.getHeaders();
		
		int bodyOffset = analyzedRequest.getBodyOffset();
		
		byte[] body = Arrays.copyOfRange(request, bodyOffset, request.length);
		String bodyString = new String(body);
		
		if(bodyString.contains("destinationRegistrationId")) {
			
			JSONObject objRoot = new JSONObject(bodyString);
			JSONObject objMessage = objRoot.getJSONArray("messages").getJSONObject(0);

			String pyroUrl = "PYRO:[email protected]:9999";
			try {
				PyroProxy pp = new PyroProxy(new PyroURI(pyroUrl));
				String newMessage = (String)pp.call("callexportfunction","changemessage",new String[]{"pwned"});
				pp.close();
				
				Pattern pattern = Pattern.compile(".*content = \"(.*?)\".*");
				Matcher matcher = pattern.matcher(newMessage);
				
				if (matcher.find())	{
					
					newMessage = matcher.group(1);
					
					objMessage.put("content", newMessage);
					
					String newBodyString = objRoot.toString();
					String newBodyString2 = newBodyString.replace("/", "\\/");
					
					byte[] newRequest = helpers.buildHttpMessage(headers, newBodyString2.getBytes());
					
					messageInfo.setRequest(newRequest);
					
				}

				
			} catch(IOException e) {
				stderr.println(e.toString());
			}
			
		}
		

		
	}
	
}
 
开发者ID:federicodotta,项目名称:Brida,代码行数:57,代码来源:BurpExtender.java


注:本文中的net.razorvine.pyro.PyroProxy.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。