Created
December 7, 2010 15:17
-
-
Save amolbrid/731892 to your computer and use it in GitHub Desktop.
request processor class for Mockito inOrder invocation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.PrintWriter; | |
import java.net.Socket; | |
public class RequestProcessor { | |
private Socket socket; | |
public RequestProcessor(Socket socket) { | |
this.socket = socket; | |
} | |
public void process() { | |
try { | |
InputStream is = socket.getInputStream(); | |
// read request from input stream and process it. | |
PrintWriter pw = new PrintWriter(socket.getOutputStream()); | |
pw.append("Ok"); | |
pw.flush(); | |
} catch (IOException e) { | |
} finally { | |
try { | |
socket.close(); | |
} catch (IOException e) { } | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment