test
This commit is contained in:
parent
efa9d576d6
commit
6a73c0199b
@ -12,9 +12,11 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
implementation 'com.google.inject:guice:5.1.0'
|
||||
implementation 'com.twitter:finagle-http_2.12:22.7.0'
|
||||
implementation 'com.twitter:finagle-thrift_2.11:21.2.0'
|
||||
implementation 'io.netty:netty-transport:4.1.77.Final'
|
||||
implementation 'com.twitter:finagle-http2_2.13:22.4.0'
|
||||
implementation 'com.twitter:finagle-core_2.10:6.35.0'
|
||||
|
||||
implementation 'com.twitter:finagle-http_2.13:22.4.0'
|
||||
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
|
||||
}
|
||||
|
||||
@ -1,26 +1,34 @@
|
||||
package ro.mihai;
|
||||
|
||||
import com.twitter.finagle.Http;
|
||||
import com.twitter.finagle.Service;
|
||||
import com.twitter.finagle.http.Http;
|
||||
import com.twitter.finagle.builder.ServerBuilder;
|
||||
import com.twitter.util.Future;
|
||||
|
||||
|
||||
|
||||
import org.jboss.netty.handler.codec.http.*;
|
||||
import org.jboss.netty.handler.codec.http.HttpRequest;
|
||||
import org.jboss.netty.handler.codec.http.HttpResponse;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
|
||||
Service<HttpRequest, HttpResponse> service = new Service<HttpRequest, HttpResponse>() {
|
||||
public Future<HttpResponse> apply(HttpRequest request) {
|
||||
return Future.value(
|
||||
new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK));
|
||||
DefaultHttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
|
||||
return Future.value(response);
|
||||
}
|
||||
};
|
||||
|
||||
ServerBuilder.safeBuild(service, ServerBuilder.get()
|
||||
.codec(Http())
|
||||
.name("HttpServer")
|
||||
.bindTo(new InetSocketAddress("localhost", 5151)));
|
||||
.bindTo(new InetSocketAddress("localhost", 10000)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user