Have you tried something like:
Args eventArgs = new Args();
eventArgs.put("sourcetype", "access_combined.log");
eventArgs.put("host", "local");
...
String eventText = date+eventArgs+" text=Testing!";
...
stream.write(eventText.getBytes("UTF8"));
In the docs it implies the methods for submit and attachWith are the same, eg
Use the submit method to send an event over HTTP. You'll need to provide the event as a string, and can specify values to apply to the event (host, source, and sourcetype).
Use the attach and attachWith methods to send events over a writeable socket. You can also specify the values to apply to these events (host, source, and sourcetype).
... View more