Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Weekly Challenge #10

The Weekly Programming Challenge :


Requires Leiningen to build:

lein uberjasr


To start the server:

$ java -jar target/uberjar/weekly-ten-0.1.0-SNAPSHOT-standalone.jar --server <port>

To launch a client that will send a query to the server:

$ java -jar target/uberjar/weekly-ten-0.1.0-SNAPSHOT-standalone.jar --client <host> <port> <query>

The query engine is really simple - it simply returns the query reversed.

The Phteven Variant

$ java -jar target/uberjar/weekly-ten-0.1.0-SNAPSHOT-standalone.jar --pherver <port>

This starts a server that will delegate queries to Phteven.IO :-)

Use it like so:

$ java -jar target/uberjar/weekly-ten-0.1.0-SNAPSHOT-standalone.jar --client <host> <port> "Hello, Steven"

> Querying server localhost:9999 : Hello, Steven => 
> Hello, Phteven


The server is built in a way that allows a custom ‘handler’ to be defined. When launching from the command-line the simple-protocol-handler is used.

The server uses good old threads to support multiple concurrent clients.

The simple-protocol-handler defines the protocol described in the challenge.

The server can be started in embedded mode like so:

(weekly-ten.server/start-server handler-function port)

where the handler-function is a function that takes two parameters: a (for reading from the client) and a (for writing to the client). The accepting connections, managing resources etc. is handled outside of this.

So - in theory - implementing the HTTP server should be possible by simple adding another “handler function”.

Due to lack of time I decided to skip the HTTP client/server challenge. Instead I decided to implement a simple HTTP POST client, and to implement a query-handler that send the query to Phteven.IO to get a phtevenized response :-).


Most likely.


Copyright © 2016

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.


No releases published


No packages published