This file covers integration test servers, how to add new ones, known compatibility quirks, and the test key inventory for agents working on tests.
Integration tests live in sshlib/src/test/.../client/ and use Testcontainers to spin up
real SSH servers in Docker. All require Docker to be running.
| Test class | Server | Docker resource dir | Port | Wait log pattern |
|---|---|---|---|---|
SshClientIntegrationTest |
OpenSSH 9.9p2 | openssh-server/ |
22 | Server listening |
PortForwardingIntegrationTest |
OpenSSH 9.9p2 | openssh-server/ |
22 | Server listening |
SftpClientIntegrationTest |
OpenSSH 9.9p2 | openssh-server/ |
22 | Server listening |
AsyncSshCompatibilityTest |
AsyncSSH (Python) | asyncssh-server/ |
8022 | LISTENER READY |
DropbearCompatibilityTest |
Dropbear | dropbear-server/ |
22 | Not backgrounding |
All servers use credentials testuser / testpass. Public keys from resources/keys/*.pub
are injected into the Docker build via withFileFromClasspath.
- Create a Docker resource directory under
sshlib/src/test/resources/with aDockerfile. - In the test class, build the image with
ImageFromDockerfile("name", false).withFileFromClasspath(".", "dir-name"). - Inject test public keys with
.withFileFromClasspath("keyname.pub", "keys/keyname.pub"). - Use
BlockingSshClientfor tests (wrapsSshClientwithrunBlocking). - Parameterize algorithm tests with
@ParameterizedTest+@MethodSource.
- Dropbear + RSA pubkey auth: Dropbear rejects RSA public key authentication. The
rsa_unencryptedkey is excluded from Dropbear pubkey tests. - AsyncSSH + legacy algorithms: AsyncSSH disables legacy algorithms by default. The server's
create_server()call inserver.pyexplicitly enables them (CBC ciphers, DH group1, hmac-sha1, etc.). - AsyncSSH + ML-KEM: AsyncSSH requires the
liboqsC library for post-quantum kex (mlkem768x25519-sha256). This is not installed in the test Docker image, so ML-KEM is only tested against Dropbear. - Dropbear + custom options: The
DropbearCompatibilityTest.authenticateWithOptions()helper spins up a fresh container with customOPTIONSenv var (passed todropbearCLI). Used for host key type tests with-r <keypath>.
Test key pairs are in sshlib/src/test/resources/keys/. Available types: ed25519,
ecdsa256/384/521, rsa (both encrypted and unencrypted variants, plus PEM and PKCS#8 formats).
The OpenSSH integration test also has its own test_ed25519 key pair in the
openssh-server/ resource dir.