try {
WrappedSocketConnection connection = new WrappedSocketConnection(host, 1220);
connection.writeByte((byte) RemoteFileServer.Action.OUTPUT_STREAM.ordinal());
connection.writeString(relPath.getPath());
connection.flush();
long answer = connection.readLong();
if (answer == BaseServer.LONG_OK) {
return connection.getOs();
} else {
String message = connection.readString();
throw new RuntimeException("Received unexpected response while creating output stream to " + host + ":" + port + " " + message);