Skip to content
Browse files

Define port number when the main method is started

  • Loading branch information...
1 parent e11d829 commit e7ef88a253d139e4722e24b16fd8b7e4a4d251d4 @asomov asomov committed Oct 4, 2012
View
8 mock-server/src/main/java/com/zaubersoftware/gnip4j/server/Main.java
@@ -21,19 +21,15 @@
/**
* Main entry point to start the {@link GnipServer}
- *
- * @author Guido Marucci Blas
- * @since 11/11/2011
*/
public final class Main {
-
private static final int DEFAUL_SERVER_PORT = 8080;
+
private static final InputStream ACTIVITIES = Main.class.getClassLoader().getResourceAsStream(
- //"com/zaubersoftware/gnip4j/server/activity/activities.json");
"com/zaubersoftware/gnip4j/server/activity/unlimitedActivity.json");
public static void main(final String[] args) throws InterruptedException {
- final MockServer mockServer = new MockServer();
+ final MockServer mockServer = new MockServer(DEFAUL_SERVER_PORT);
mockServer.start(ACTIVITIES);
}
View
2 ...src/main/java/com/zaubersoftware/gnip4j/server/netty/LimitedNettyChunkedInputFactory.java
@@ -33,7 +33,7 @@
*
* Creates the NettyHandlerAggregator.
* @param limitedActivities
- * @param timesToStart the times that the mock server will start and shutdown client's connections.
+ * @param numberOfChunks
*/
public LimitedNettyChunkedInputFactory(final InputStream limitedActivities,
final int numberOfChunks) {
View
16 mock-server/src/main/java/com/zaubersoftware/gnip4j/server/netty/MockServer.java
@@ -24,28 +24,28 @@
*
* Implementation of Mock Server
*
- *
* @author Ignacio De Maio
* @since Jan 4, 2012
*/
public class MockServer {
private static GnipServer gnipServer;
- private final int DEFAUL_SERVER_PORT = 8080;
+
+
private NettyChunkedInputFactory chunkedInputFactory;
+
+ private int portNumber;
- /**
- *
- */
- public MockServer(){
+ public MockServer(int portNumber){
+ this.portNumber = portNumber;
}
void start() {
final GnipServerFactory gnipServerFactory = new NettyGnipServerFactory();
- gnipServer = gnipServerFactory.createServer(DEFAUL_SERVER_PORT, chunkedInputFactory);
+ gnipServer = gnipServerFactory.createServer(portNumber, chunkedInputFactory);
gnipServer.start();
- System.out.println("Gnip server started at port " + DEFAUL_SERVER_PORT);
+ System.out.println("Gnip mock server started at port " + portNumber);
}
public void start(final InputStream activities) {
View
1 ...er/src/main/java/com/zaubersoftware/gnip4j/server/netty/SlowNettyChunkedInputFactory.java
@@ -35,7 +35,6 @@
*
* Creates the NettyHandlerAggregator.
* @param limitedActivities
- * @param timesToStart the times that the mock server will start and shutdown client's connections.
*/
public SlowNettyChunkedInputFactory(final InputStream limitedActivities,
final int timeBetweenChunks) {

0 comments on commit e7ef88a

Please sign in to comment.
Something went wrong with that request. Please try again.