Moved code from tegonal branch of airbrake-java