@Test
public void testAssociationCommands() throws Exception {

    String sctpAssocCommand = "sctp association create Assoc1 CLIENT 127.0.0.1 2905 127.0.0.1 2906";
    String result = this.sctpShellExecutor.execute(sctpAssocCommand.split(" "));
    assertEquals(result,
            String.format(SCTPOAMMessages.ADD_CLIENT_ASSOCIATION_SUCCESS, "Assoc1", this.management1.getName()));
    assertEquals(1, this.management1.getAssociations().size());
    assertEquals(0, this.management2.getAssociations().size());
    sctpAssocCommand = "sctp association create Assoc2 CLIENT 127.0.0.1 2907 127.0.0.1 2908 stackname TestSCTP2";
    result = this.sctpShellExecutor.execute(sctpAssocCommand.split(" "));
    assertEquals(result,
            String.format(SCTPOAMMessages.ADD_CLIENT_ASSOCIATION_SUCCESS, "Assoc2", this.management2.getName()));
    assertEquals(1, this.management1.getAssociations().size());
    assertEquals(1, this.management2.getAssociations().size());
    // Test creating server association
    String sctpServerCommand = "sctp server create TestServer1 127.0.0.1 2903 stackname TestSCTP1";
    result = this.sctpShellExecutor.execute(sctpServerCommand.split(" "));
    assertEquals(result, String.format(SCTPOAMMessages.ADD_SERVER_SUCCESS, "TestServer1", this.management1.getName()));
    sctpAssocCommand = "sctp association create Assoc3 SERVER TestServer1 192.168.56.1 2905";
    result = this.sctpShellExecutor.execute(sctpAssocCommand.split(" "));
    assertEquals(result,
            String.format(SCTPOAMMessages.ADD_SERVER_ASSOCIATION_SUCCESS, "Assoc3", this.management1.getName()));
    assertEquals(2, this.management1.getAssociations().size());
    assertEquals(1, this.management2.getAssociations().size());
    sctpAssocCommand = "sctp association show";
    result = this.sctpShellExecutor.execute(sctpAssocCommand.split(" "));
    System.out.println(result);
    assertTrue(result.contains("Assoc1") && result.contains("Assoc3"));
    assertFalse(result.contains("Assoc2"));
    sctpAssocCommand = "sctp association show stackname TestSCTP2";
    result = this.sctpShellExecutor.execute(sctpAssocCommand.split(" "));
    System.out.println(result);
    assertTrue(result.contains("Assoc2"));
    assertFalse(result.contains("Assoc1") || result.contains("Assoc3"));
    sctpAssocCommand = "sctp association destroy Assoc2";
    result = this.sctpShellExecutor.execute(sctpAssocCommand.split(" "));
    assertEquals(result, String.format(SCTPOAMMessages.REMOVE_ASSOCIATION_SUCCESS, "Assoc2", this.management2.getName()));
    assertEquals(2, this.management1.getAssociations().size());
    assertEquals(0, this.management2.getAssociations().size());
    sctpAssocCommand = "sctp association destroy Assoc1 stackname TestSCTP1";
    result = this.sctpShellExecutor.execute(sctpAssocCommand.split(" "));
    assertEquals(result, String.format(SCTPOAMMessages.REMOVE_ASSOCIATION_SUCCESS, "Assoc1", this.management1.getName()));
    assertEquals(1, this.management1.getAssociations().size());
    assertEquals(0, this.management2.getAssociations().size());
    sctpAssocCommand = "sctp association destroy Assoc3 stackname TestSCTP1";
    result = this.sctpShellExecutor.execute(sctpAssocCommand.split(" "));
    assertEquals(result, String.format(SCTPOAMMessages.REMOVE_ASSOCIATION_SUCCESS, "Assoc3", this.management1.getName()));
    assertEquals(0, this.management1.getAssociations().size());
    assertEquals(0, this.management2.getAssociations().size());
}