-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelloInterface_Stub.java
64 lines (56 loc) · 2.05 KB
/
HelloInterface_Stub.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Decompiled by DJ v3.2.2.67 Copyright 2002 Atanas Neshkov Date: 1/22/03 1:40:21 AM
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
import java.io.*;
import java.lang.*;
import java.lang.reflect.*;
import java.util.*;
import java.rmi.*;
import java.rmi.server.*;
import java.net.*;
public final class HelloInterface_Stub extends NERemoteObjectStub implements HelloInterface, NERemote {
public String sayHello (String s) throws NERemoteException {
try {
Class<?>[] argTypes = { String.class };
Serializable[] arguments = { s };
System.out.println (getKey ());
NEMethodInvocation message =
new NEMethodInvocation
(getKey (), HelloInterface.class, "sayHello", argTypes, arguments);
Socket reg = new Socket ("localhost", 5001);
System.out.println ("Connected to object server");
NEMarshaller.marshalMethodInvocation (message, reg.getOutputStream ());
System.out.println ("Marhsalled method invocation");
ObjectInputStream in = new ObjectInputStream (reg.getInputStream ());
char rtype = in.readChar ();
if (rtype == 'e') {
NEException ex = (NEException) in.readObject ();
System.out.println ("Received exception");
reg.close ();
throw ex.getException ();
}
else if (rtype == 'r') {
NEReturnValue rv = (NEReturnValue) in.readObject ();
System.out.println ("Received return value");
String result = (String) NEDemarshaller.demarshalReturnValue (rv);
reg.close ();
return result;
}
}
catch (SocketException e) {
throw new NERemoteException ("Communication with server failed");
}
catch (IOException e) {
throw new NERemoteException ("Communication with server failed");
}
catch (ClassNotFoundException e) {
// Should not reach here
}
catch (RuntimeException e) {
throw e;
}
catch (Exception e) {
}
return null;
}
}