MessageActionFactory { public static AsciiAction createAsciiAction(AliasedConnection connection, ConnectionEndType sendingConnectionEnd, String message, String encoding) { AsciiAction action; if (connection.getLocalConnectionEndType() == sendingConnectionEnd) { action = new SendAsciiAction(message, encoding); } else { action = new GenericReceiveAsciiAction(encoding); } return action; } private  MessageActionFactory(); static MessageAction createAction(AliasedConnection connection, ConnectionEndType sendingConnectionEndType,
            ProtocolMessage... protocolMessages); static MessageAction createAction(AliasedConnection connection, ConnectionEndType sendingConnectionEnd,
            List<ProtocolMessage> protocolMessages); static AsciiAction createAsciiAction(AliasedConnection connection, ConnectionEndType sendingConnectionEnd,
            String message, String encoding);  }
@Test public void testCreateAsciiAction() { AsciiAction action = MessageActionFactory.createAsciiAction(clientConnection, ConnectionEndType.CLIENT, "", ""); assertEquals(action.getClass(), SendAsciiAction.class); action = MessageActionFactory.createAsciiAction(clientConnection, ConnectionEndType.SERVER, "", ""); assertEquals(action.getClass(), GenericReceiveAsciiAction.class); action = MessageActionFactory.createAsciiAction(serverConnection, ConnectionEndType.CLIENT, "", ""); assertEquals(action.getClass(), GenericReceiveAsciiAction.class); action = MessageActionFactory.createAsciiAction(serverConnection, ConnectionEndType.SERVER, "", ""); assertEquals(action.getClass(), SendAsciiAction.class); }