@Override
  public Session toManagementSession() {
    SessionBuilder builder = new SessionBuilder();

    builder.setSessionId(getSessionId());
    IpAddress address;
    InetAddress address1 = InetAddresses.forString(header.getAddress());
    if (address1 instanceof Inet4Address) {
      address = new IpAddress(new Ipv4Address(header.getAddress()));
    } else {
      address = new IpAddress(new Ipv6Address(header.getAddress()));
    }
    builder.setSourceHost(new Host(address));

    Preconditions.checkState(DateAndTime.PATTERN_CONSTANTS.size() == 1);
    String formattedDateTime = dateFormatter.format(loginTime);

    Matcher matcher = dateTimePattern.matcher(formattedDateTime);
    Preconditions.checkState(
        matcher.matches(),
        "Formatted datetime %s does not match pattern %s",
        formattedDateTime,
        dateTimePattern);
    builder.setLoginTime(new DateAndTime(formattedDateTime));

    builder.setInBadRpcs(new ZeroBasedCounter32(inRpcFail));
    builder.setInRpcs(new ZeroBasedCounter32(inRpcSuccess));
    builder.setOutRpcErrors(new ZeroBasedCounter32(outRpcError));

    builder.setUsername(header.getUserName());
    builder.setTransport(getTransportForString(header.getTransport()));

    builder.setOutNotifications(new ZeroBasedCounter32(outNotification));

    builder.setKey(new SessionKey(getSessionId()));

    Session1Builder builder1 = new Session1Builder();
    builder1.setSessionIdentifier(header.getSessionIdentifier());
    builder.addAugmentation(Session1.class, builder1.build());

    return builder.build();
  }
 private String getClientAddress() {
   return netconfHelloMessageAdditionalHeader.getAddress();
 }