@@ -33,7 +33,7 @@ public abstract class AbstractGrizzlyServerTester extends TestCase {
33
33
private SelectorThread selectorThread ;
34
34
35
35
private int port = getEnvVariable ("JERSEY_HTTP_PORT" , 9997 );
36
-
36
+
37
37
private static int getEnvVariable (final String varName , int defaultValue ) {
38
38
if (null == varName ) {
39
39
return defaultValue ;
@@ -52,26 +52,26 @@ private static int getEnvVariable(final String varName, int defaultValue) {
52
52
public AbstractGrizzlyServerTester (String name ) {
53
53
super (name );
54
54
}
55
-
55
+
56
56
public UriBuilder getUri () {
57
57
return UriBuilder .fromUri ("http://localhost" ).port (port ).path (CONTEXT );
58
58
}
59
-
60
- public void startServer (Class ... resources ) {
59
+
60
+ public void startServer (Class <?> ... resources ) {
61
61
start (ContainerFactory .createContainer (Adapter .class , resources ));
62
62
}
63
-
63
+
64
64
public void startServer (ResourceConfig config ) {
65
65
start (ContainerFactory .createContainer (Adapter .class , config ));
66
66
}
67
-
67
+
68
68
private void start (Adapter adapter ) {
69
69
if (selectorThread != null && selectorThread .isRunning ()){
70
70
stopServer ();
71
71
}
72
72
73
73
System .out .println ("Starting GrizzlyServer port number = " + port );
74
-
74
+
75
75
URI u = UriBuilder .fromUri ("http://localhost" ).port (port ).build ();
76
76
try {
77
77
selectorThread = GrizzlyServerFactory .create (u , adapter );
@@ -91,13 +91,13 @@ private void start(Adapter adapter) {
91
91
}
92
92
}
93
93
}
94
-
94
+
95
95
public void stopServer () {
96
96
if (selectorThread .isRunning ()) {
97
97
selectorThread .stopEndpoint ();
98
98
}
99
99
}
100
-
100
+
101
101
@ Override
102
102
public void tearDown () {
103
103
stopServer ();
0 commit comments