Code example for ProtocolException

            method = POST;
        // If the request method is neither PUT or POST, then you're not writing 
        if (method != PUT && method != POST) {
            throw new ProtocolException("Can only write to PUT or POST");
        if (!connected) {
            // connect and see if there is cache available. 
        return os = new ByteArrayOutputStream();
    public void setChunked(boolean chunked) {
        this.chunked = chunked;
Stop searching for code, let great code find you!  Add Codota to your java IDE