Repository: quarkusio/quarkus
Issue: Remote dev mode with gradle throwing connection refused

### Describe the bug

I am attempting to run remote dev mode via Gradle against a Kubernetes deployment. Everything appears to be working as expected, mutable jar deployed in a container, logs show live coding enabled. When I attempt to connect via `./gradlew quarkusRemoteDev` I get a connection refused.

### Expected behavior

Remote dev mode working.

### Actual behavior

The server side throws a BadRequestException and my workstation fails to connect. 

The issue mentioned in https://github.com/quarkusio/quarkus/pull/12969 seems similar. Specifically "The JDK client sends malformed q values (.2 instead of 0.2), resteasy rejects this with a bad request exception". 

I captured the initial http requests coming from HttpRemoteDevClient and verified the Header values  `*; q=.2, */*; q=.2` were being included which I'm assuming is causing the issue. 

Here's the server side stacktrace:

```text
2021-10-19 19:35:34,387 INFO  [io.quarkus] [{}] (Quarkus Main Thread) Profile dev activated. Live Coding activated. 
2021-10-19 19:35:34,387 INFO  [io.quarkus] [{}] (Quarkus Main Thread) Installed features: [agroal, cdi, config-yaml, elasticsearch-rest-client, elasticsearch-rest-high-level-client, flyway, hibernate-orm, jdbc-postgresql, kubernetes-client, narayana-jta, quartz, reactive-routes, rest-client, rest-client-jackson, resteasy, resteasy-jackson, resteasy-mutiny, scheduler, security, smallrye-context-propagation, smallrye-health, smallrye-jwt, smallrye-metrics, smallrye-openapi, smallrye-reactive-messaging, smallrye-reactive-messaging-amqp, swagger-ui, vertx] 
2021-10-19 19:38:02,062 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] [{}] (executor-thread-0) HTTP Request to /connect failed, error id: a2e06b4b-fd41-4203-a991-88eee1224451-1: javax.ws.rs.BadRequestException: RESTEASY003520: Malformed quality value. 
	at org.jboss.resteasy.core.request.QualityValue.parseAsInteger(QualityValue.java:113) 
	at org.jboss.resteasy.core.request.QualityValue.valueOf(QualityValue.java:40) 
	at org.jboss.resteasy.core.request.AcceptHeaders.evaluateAcceptParameters(AcceptHeaders.java:292) 
	at org.jboss.resteasy.core.request.AcceptHeaders.getMediaTypeQualityValues(AcceptHeaders.java:170) 
	at org.jboss.resteasy.core.request.ServerDrivenNegotiation.setAcceptHeaders(ServerDrivenNegotiation.java:41) 
	at io.quarkus.resteasy.runtime.NotFoundExceptionMapper.selectVariant(NotFoundExceptionMapper.java:386) 
	at io.quarkus.resteasy.runtime.NotFoundExceptionMapper.respond(NotFoundExceptionMapper.java:244) 
	at io.quarkus.resteasy.runtime.NotFoundExceptionMapper.toResponse(NotFoundExceptionMapper.java:225) 
	at io.quarkus.resteasy.runtime.NotFoundExceptionMapper.toResponse(NotFoundExceptionMapper.java:53) 
	at org.jboss.resteasy.core.ExceptionHandler.executeExactExceptionMapper(ExceptionHandler.java:65) 
	at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:317) 
	at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:218) 
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:258) 
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:161) 
	at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364) 
	at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:164) 
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:247) 
	at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:73) 
	at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:135) 
	at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:90) 
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$13.runWith(VertxCoreRecorder.java:543) 
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) 
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) 
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29) 
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29) 
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) 
	at java.base/java.lang.Thread.run(Unknown Source) 
```

### How to Reproduce?

_No response_

### Output of `uname -a` or `ver`

Microsoft Windows Version 10.0.19042 Build 19042

### Output of `java -version`

JVM:  11.0.2 (Oracle Corporation 11.0.2+9)

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.3.0

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

Gradle 6.8.3

### Additional information

_No response_

Changed files:
extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/HttpRemoteDevClient.java

diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/HttpRemoteDevClient.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/HttpRemoteDevClient.java
index aacf027f117..f3253f45768 100644
--- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/HttpRemoteDevClient.java
+++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/HttpRemoteDevClient.java
@@ -32,6 +32,16 @@ public class HttpRemoteDevClient implements RemoteDevClient {
 
     private final Logger log = Logger.getLogger(HttpRemoteDevClient.class);
 
+    /**
+     * The default Accept header defined in sun.net.www.protocol.http.HttpURLConnection is invalid and
+     * does not respect the RFC so we override it with a valid value.
+     * RESTEasy is quite strict regarding the RFC and throws an error.
+     * Note that this is just the default HttpURLConnection header value made valid.
+     * See https://bugs.openjdk.java.net/browse/JDK-8163921 and https://bugs.openjdk.java.net/browse/JDK-8177439
+     * and https://github.com/quarkusio/quarkus/issues/20904
+     */
+    private static final String DEFAULT_ACCEPT = "text/html, image/gif, image/jpeg; q=0.2, */*; q=0.2";
+
     private final String url;
     private final String password;
     private final long reconnectTimeoutMillis;
@@ -95,6 +105,7 @@ private void sendData(Map.Entry<String, byte[]> entry, String session) throws IO
             connection = (HttpURLConnection) new URL(url + "/" + entry.getKey()).openConnection();
             connection.setRequestMethod("PUT");
             connection.setDoOutput(true);
+            connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
             connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(), RemoteSyncHandler.APPLICATION_QUARKUS);
             connection.addRequestProperty(RemoteSyncHandler.QUARKUS_SESSION_COUNT, Integer.toString(currentSessionCounter));
 
@@ -120,6 +131,7 @@ private String doConnect(RemoteDevState initialState, Function<Set<String>, Map<
 
             HttpURLConnection connection = (HttpURLConnection) new URL(url + RemoteSyncHandler.CONNECT)
                     .openConnection();
+            connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
             connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(), RemoteSyncHandler.APPLICATION_QUARKUS);
             //for the connection we use the hash of the password and the contents
             //this can be replayed, but only with the same contents, and this does not affect the server
@@ -195,6 +207,7 @@ public void run() {
                     //long polling request
                     //we always send the current problem state
                     connection = (HttpURLConnection) devUrl.openConnection();
+                    connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
                     connection.setRequestMethod("POST");
                     connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(), RemoteSyncHandler.APPLICATION_QUARKUS);
                     connection.addRequestProperty(RemoteSyncHandler.QUARKUS_SESSION_COUNT,
@@ -223,6 +236,7 @@ public void run() {
                             }
                             log.info("deleting " + file);
                             connection = (HttpURLConnection) new URL(url + "/" + file).openConnection();
+                            connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
                             connection.setRequestMethod("DELETE");
                             connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(),
                                     RemoteSyncHandler.APPLICATION_QUARKUS);
@@ -270,6 +284,7 @@ private String waitForRestart(RemoteDevState initialState,
             while (System.currentTimeMillis() < timeout) {
                 try {
                     HttpURLConnection connection = (HttpURLConnection) probeUrl.openConnection();
+                    connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
                     connection.setRequestMethod("POST");
                     connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(), RemoteSyncHandler.APPLICATION_QUARKUS);
                     IoUtil.readBytes(connection.getInputStream());