Using Core
Installing
To install Diferencia Java Core you only need to add next dependency on your build tool.
For now Diferencia is released in jcenter
but in near future will be released in Maven central as well.
pom.xml
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
Code Example
The main class of this module is com.lordofthejars.diferencia.core.Diferencia
which is the entrypoint that deals with Diferencia.
Example.java
final DiferenciaConfiguration.Builder configurationBuilder =
new DiferenciaConfiguration
.Builder("http://now.httpbin.org", "http://now.httpbin.org")
.withSecondary("http://now.httpbin.org").withNoiseDetection(true); (1)
diferencia = new Diferencia(configurationBuilder); (2)
diferencia.start(); (3)
final String diferenciaUrl = diferencia.getDiferenciaUrl(); (4)
final Response response = sendRequest(diferenciaUrl, "/"); (5)
diferencia.close(); (6)
1 | Configuration parameters |
2 | Instantiate Diferencia with given configuration |
3 | Start Diferencia and wait until it is up and running. |
4 | Gets URL to send requests |
5 | Sends a request to Diferencia. |
6 | Last you need to stop Diferencia |
You don’t need to download anything manually, everything is automatically installed. |