ES Plugin add to Node server programmatically

This is because of the collections API of Java where generic types are not reified, they are not available at runtime .

In ES 2.1.1, use something like

public class MockNode extends Node {

    public MockNode(Settings settings, List<Class<? extends Plugin>> classpathPlugins) {
        super(InternalSettingsPreparer.prepareEnvironment(settings, null), Version.CURRENT, classpathPlugins);
    }

    public MockNode(Settings settings, Class<? extends Plugin> classpathPlugin) {
        this(settings, list(classpathPlugin));
    }
    
    private static List<Class<? extends Plugin>> list(Class<? extends Plugin> classpathPlugin) {
        List<Class<? extends Plugin>> list = new ArrayList<>();
        list.add(classpathPlugin);
        return list;
    }

}