public Optional<UserAgent> getUserAgent(final LocalAddress localAddress) {
    return Optional.ofNullable(remoteChannelsByLocalAddress.get(localAddress))
        .map(remoteChannel -> remoteChannel.attr(PARSED_USER_AGENT_ATTRIBUTE_KEY).get());
  }
@Test
  void getUserAgent() throws UnrecognizedUserAgentException {
    clientConnectionManager.handleConnectionEstablished(localChannel, remoteChannel, Optional.empty());

    assertEquals(Optional.empty(),
        clientConnectionManager.getUserAgent(localChannel.localAddress()));

    final UserAgent userAgent = UserAgentUtil.parseUserAgentString("Signal-Desktop/1.2.3 Linux");
    remoteChannel.attr(ClientConnectionManager.PARSED_USER_AGENT_ATTRIBUTE_KEY).set(userAgent);

    assertEquals(Optional.of(userAgent),
        clientConnectionManager.getUserAgent(localChannel.localAddress()));
  }