# Http.enabled with ESIntegTestCase

**URL:** <https://discuss.elastic.co/t/http-enabled-with-esintegtestcase/102032>\
**Category:** Elasticsearch\
**Created:** [September 27, 2017, 9:04pm UTC](https://discuss.elastic.co/t/http-enabled-with-esintegtestcase/102032 "2017-09-27T21:04:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hanisaf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hanisaf/32/20571_2.png) [@hanisaf](https://discuss.elastic.co/u/hanisaf)\
**Post date:** [September 27, 2017, 9:04pm UTC](https://discuss.elastic.co/t/http-enabled-with-esintegtestcase/102032/1 "2017-09-27T21:04:23Z")

</div>

I'm new to writing elastic search plugin and I am still getting through the basics. I'd like to be able to test and debug my plugin from IDE. I rely on breakpoints and tracing the code to figure out what is going on.

I just realized that with ESIntegTestCase the mock cluster is not bound to http. I prefer to be able to interact with the server from the browser. I understand that this practice has been continued for good reasons and is not the default anymore. However, I'm wondering if it is possible to have http enabled anyhow. Thanks.

Here is the class I have

```
public class BasicPluginIntegrationTest extends ESIntegTestCase {
	private Client client;

	@Override
	protected Collection<Class<? extends Plugin>> nodePlugins() {
		return Collections.singleton(BasicPlugin.class);
	}

	@Override
	protected Settings nodeSettings(int nodeOrdinal) {
		int randomPort = 9200; // randomIntBetween(49152, 65525);
		System.out.println("Hani " + NetworkModule.HTTP_ENABLED.getKey());
		Settings.Builder builder = Settings.builder().put(super.nodeSettings(nodeOrdinal))
				.put(NetworkModule.HTTP_ENABLED.getKey(), true)
				.put(HttpTransportSettings.SETTING_HTTP_PORT.getKey(), randomPort).put("network.host", "127.0.0.1");
		Settings settings = builder.build();

		return settings;
	}

	
	@Test
	public void testLive() {
		System.out.println("Server live, hit enter to quit");
		(new Scanner(System.in)).nextLine();

	}

}

```

I am getting the following error

```
java.lang.IllegalStateException: Unsupported http.type []
	at org.elasticsearch.common.network.NetworkModule.getHttpServerTransportSupplier(NetworkModule.java:194)
	at org.elasticsearch.node.Node.<init>(Node.java:396)
	at org.elasticsearch.node.MockNode.<init>(MockNode.java:61)
	at org.elasticsearch.test.InternalTestCluster.buildNode(InternalTestCluster.java:616)
	at org.elasticsearch.test.InternalTestCluster.reset(InternalTestCluster.java:1048)
	at org.elasticsearch.test.InternalTestCluster.beforeTest(InternalTestCluster.java:986)
	at org.elasticsearch.test.ESIntegTestCase.beforeInternal(ESIntegTestCase.java:353)
	at org.elasticsearch.test.ESIntegTestCase.before(ESIntegTestCase.java:1989)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1713)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:941)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:957)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:49)
	at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
	at o...
```

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [September 27, 2017, 11:16pm UTC](https://discuss.elastic.co/t/http-enabled-with-esintegtestcase/102032/2 "2017-09-27T23:16:49Z")

</div>

Enabling http requires having an http transport implementation. This is handled in elasticsearch in a module called transport-netty4, but modules are not added to the classpath of plugins. If you use the official gradle plugin for building your elasticsearch plugin, you automatically get a `integTest` task which you can write http based REST tests against, just like we test our official plugins.

---

<div class="post-metadata">

**Author:** ![hanisaf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hanisaf/32/20571_2.png) [@hanisaf](https://discuss.elastic.co/u/hanisaf)\
**Post date:** [September 28, 2017, 3:18am UTC](https://discuss.elastic.co/t/http-enabled-with-esintegtestcase/102032/3 "2017-09-28T03:18:24Z")

</div>

I'm using Maven and I have netty4 as test task dependency. I guess the question is how to "run it" within the ESIntegTestCase. I got it to work by changing the BasicPlugin class to extend Netty4Plugin rather than Plugin, but then the plugin refused to work in the real Elasticsearch server, presumably because netty4 was already enabled.

> ```
> <dependency>
> <groupId>org.elasticsearch.plugin</groupId>
> <artifactId>transport-netty4-client</artifactId>
> <version>${elasticsearch.version}</version>
> <scope>test</scope>
> </dependency>
> 
> ```

---

<div class="post-metadata">

**Author:** ![hanisaf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hanisaf/32/20571_2.png) [@hanisaf](https://discuss.elastic.co/u/hanisaf)\
**Post date:** [September 28, 2017, 3:57am UTC](https://discuss.elastic.co/t/http-enabled-with-esintegtestcase/102032/4 "2017-09-28T03:57:39Z")

</div>

I just got it to work. It turns out I needed to have the two plugin in nodePlugins(). Thanks

```
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
	Collection<Class<? extends Plugin>> al = new ArrayList<Class<? extends Plugin>>();
	al.add(Netty4Plugin.class);
	al.add(BasicPlugin.class);
	return al;
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 26, 2017, 3:57am UTC](https://discuss.elastic.co/t/http-enabled-with-esintegtestcase/102032/5 "2017-10-26T03:57:41Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
