NATBehavior result = new NATBehavior();
final Message requestMessage = MessageStaticFactory.newSTUNMessageInstance(STUNMessageClass.REQUEST,
STUNMessageMethod.NAT_REQUEST);
requestMessage.addAttribute(new Username(targetId));
requestMessage.writeTo(this.mediatorConnection.getControlConnection().getOutputStream());
final MessageReader messageReader = MessageReader
.createMessageReaderWithCustomAttributeTypeDecoder(new NATAttributeTypeDecoder());
final Message response = messageReader.readSTUNMessage(this.mediatorConnection.getControlConnection()
.getInputStream());
if (response.hasAttribute(NATBehavior.class)) {
result = response.getAttribute(NATBehavior.class);
}
this.logger.debug("target {} is behind nat {}", targetId, result.toString()); //$NON-NLS-1$