// Purpose. Proxy design pattern // 1. Create a "wrapper" for a remote, or expensive, or sensitive target // 2. Encapsulate the complexity/overhead of the target in the wrapper // 3. The client deals with the wrapper // 4. The wrapper delegates to the target // 5. To support plug-compatibility of wrapper and target, create an interface import java.io.*; import java.net.*; interface SocketInterface { // 5. To support plug-compatibility String readLine(); // between the wrapper and the void writeLine( String str ); // target, create an interface void dispose(); } public class ButtonProxy { SocketInterface socket; public ButtonProxy() { BufferedReader nPut = new BufferedReader(new InputStreamReader(System.in)); socket = new SocketProxy( "soc4.acpub.duke.edu", 8189, false); } public String[] arrayInit() { String[] temp = new String[100]; for (int i=0;i