Repository: apache/mina-sshd
Issue: Server side heartbeat not working

### Version

master

### Bug description

dependency：
```
<dependency>
    <groupId>org.apache.sshd</groupId>
    <artifactId>sshd-core</artifactId>
    <version>2.7.0</version>
</dependency>
```
Code：
```
SshServer sshd = SshServer.setUpDefaultServer();
sshd.setPort(3333);
sshd.setShellFactory(InteractiveProcessShellFactory.INSTANCE);
sshd.setSessionHeartbeat(SessionHeartbeatController.HeartbeatType.IGNORE, Duration.ofSeconds(5));
sshd.setKeyPairProvider(new ClassLoadableResourceKeyPairProvider(getClass().getClassLoader(), "rsa.key"));
sshd.setPasswordAuthenticator((username, password, session) -> username.equals(password));
sshd.start();
log.info("SSHD server started");
```

ssh Client:
``` 
user/passwd = test

ssh test@127.0.0.1 -p3333 
```


### Actual behavior

read [Server Setup Manual](https://github.com/apache/mina-sshd/blob/master/docs/server-setup.md) last section

I with my SSHD has ServerSide heartbeat，But setSessionHeartbeat API didn't working, ssh session didn't get any  interval heartbeat


### Expected behavior

SSHD automatic send heartbeat message for  each ssh session

### Relevant log output

_No response_

### Other information

_No response_

Changed files:
sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java

diff --git a/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java b/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
index 41d1eb0b6..b7970aae5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
@@ -287,7 +287,7 @@ public abstract class AbstractServerSession extends AbstractSession implements S
 
             throw new SshException(SshConstants.SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE, "Unknown service: " + name);
         }
-        currentService.set(service, factory.getName(), false);
+        currentService.set(service, factory.getName(), true);
     }
 
     @Override
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java b/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
index ec655841d..d91c13d12 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
@@ -56,9 +56,11 @@ import org.apache.sshd.common.channel.RemoteWindow;
 import org.apache.sshd.common.channel.WindowClosedException;
 import org.apache.sshd.common.io.IoSession;
 import org.apache.sshd.common.kex.KexProposalOption;
+import org.apache.sshd.common.session.ReservedSessionMessagesHandler;
 import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.session.SessionContext;
 import org.apache.sshd.common.session.SessionDisconnectHandler;
+import org.apache.sshd.common.session.SessionHeartbeatController.HeartbeatType;
 import org.apache.sshd.common.session.SessionListener;
 import org.apache.sshd.common.session.helpers.AbstractConnectionService;
 import org.apache.sshd.common.session.helpers.AbstractSession;
@@ -68,6 +70,7 @@ import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.MapEntryUtils;
 import org.apache.sshd.common.util.MapEntryUtils.NavigableMapBuilder;
 import org.apache.sshd.common.util.OsUtils;
+import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.core.CoreModuleProperties;
 import org.apache.sshd.deprecated.ClientUserAuthServiceOld;
 import org.apache.sshd.server.auth.keyboard.InteractiveChallenge;
@@ -691,6 +694,26 @@ public class ServerTest extends BaseTestSupport {
         }
     }
 
+    @Test
+    public void testServerHeartbeat() throws Exception {
+        sshd.setSessionHeartbeat(HeartbeatType.IGNORE, Duration.ofMillis(500));
+        sshd.start();
+        AtomicInteger ignoreMessageCount = new AtomicInteger(0);
+        client.setReservedSessionMessagesHandler(new ReservedSessionMessagesHandler() {
+
+            @Override
+            public void handleIgnoreMessage(Session session, Buffer buffer) throws Exception {
+                ignoreMessageCount.incrementAndGet();
+            }
+        });
+        client.start();
+        try (ClientSession s = createTestClientSession(sshd)) {
+            Thread.sleep(2000);
+        }
+        long ignoreMessages = ignoreMessageCount.get();
+        assertTrue("Epected some ignore messages (server-side heartbeat)", ignoreMessages > 0 && ignoreMessages <= 5);
+    }
+
     @Test
     public void testEnvironmentVariablesPropagationToServer() throws Exception {
         AtomicReference<Environment> envHolder = new AtomicReference<>(null);