1
2
3
4
5
6
7
8
9
10 package org.mule.management;
11
12 import org.mule.module.management.agent.FixedHostRmiClientSocketFactory;
13 import org.mule.tck.junit4.FunctionalTestCase;
14
15 import java.net.ConnectException;
16 import java.net.Socket;
17
18 import org.junit.Test;
19
20 import static org.junit.Assert.fail;
21
22 public class JmxAgentDefaultConfigurationWithRMITestCase extends FunctionalTestCase
23 {
24
25 @Override
26 protected String getConfigResources()
27 {
28 return "default-with-rmi-management-config.xml";
29 }
30
31 @Test
32 public void testDefaultJmxAgent() throws Exception
33 {
34 FixedHostRmiClientSocketFactory rmiSocketFactory = new FixedHostRmiClientSocketFactory();
35 try
36 {
37 Socket socket = rmiSocketFactory.createSocket("localhost", 1099);
38 socket.close();
39 fail("Should not connect");
40 }
41 catch (ConnectException e)
42 {
43
44 }
45
46 try
47 {
48 Socket socket = rmiSocketFactory.createSocket("localhost", 1098);
49 socket.close();
50
51 }
52 catch (ConnectException e)
53 {
54 fail("Should connect");
55 }
56 }
57
58 }