We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9a11593 commit 64d7ddfCopy full SHA for 64d7ddf
src/main/java/com/github/arteam/embedhttp/EmbeddedHttpServer.java
@@ -66,7 +66,7 @@ public EmbeddedHttpServer start(InetSocketAddress address) {
66
67
for (HttpHandlerConfig config : handlers) {
68
HttpContext context = sunHttpServer.createContext(config.path, httpExchange -> {
69
- try (httpExchange) {
+ try {
70
Headers requestHeaders = httpExchange.getRequestHeaders();
71
HttpResponse response = new HttpResponse();
72
config.httpHandler.handle(new HttpRequest(httpExchange.getRequestMethod(),
@@ -80,6 +80,8 @@ public EmbeddedHttpServer start(InetSocketAddress address) {
80
httpExchange.getResponseBody().write(byteBody);
81
} catch (IOException e) {
82
e.printStackTrace();
83
+ } finally {
84
+ httpExchange.close();
85
}
86
});
87
if (config.authenticator != null) {
0 commit comments