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