Detach detach = new Detach();
detach.setHandle(localHandle);
EndpointError localError = link.getLocalError();
if( localError !=null ) {
ErrorCondition error = new ErrorCondition();
error.setCondition(Symbol.getSymbol(localError.getName()));
error.setDescription(localError.getDescription());
detach.setError(error);
}
int frameBytes = writeFrame(buffer, transportSession.getLocalChannel(), detach, null, null);